Hosting Frontend App on AWS Amplify Using GitHub


If you're building a frontend and want an easy, scalable way to host it, AWS Amplify is a great choice. With direct GitHub integration, you can set up continuous deployment in minutes. In this guide, you'll learn how to:
Connect your GitHub repo to AWS Amplify
Automatically build and deploy your React app
Enable custom domains and environment variables
Prerequisites
Before you start, make sure you have:
A Frontend app (I’ll be using React)
A GitHub repository (with your project pushed)
An AWS account (Create one if you don’t have it)
Folder Structure (Example)
Make sure your project structure looks something like:
my-react-app/
├── public/
├── src/
├── package.json
├── .gitignore
└── ...
Step 1: Push Your React App to GitHub
If your app isn’t already on GitHub:
git remote add origin https://github.com/yourusername/my-react-app.git
git add .
git commit -m "Initial commit"
git push -u origin main
Step 2: Open AWS Amplify
Go to AWS Amplify Console
Click “Get Started” under “Host your web app”
Choose GitHub as your source provider
Authorize AWS Amplify to access your GitHub account (if not done already)
Select the repository and branch of your React project
Step 3: Configure Build Settings
Amplify will auto-detect it’s a React app and suggest a default build config:
version: 1
frontend:
phases:
preBuild:
commands:
- npm ci
build:
commands:
- npm run build
artifacts:
baseDirectory: build
files:
- '**/*'
cache:
paths:
- node_modules/**/*
You can customize this if needed (e.g., for monorepos or custom directories).
Click Next.
Step 4: Deploy
Review the settings
Click “Save and Deploy”
Amplify will pull your code from GitHub, run the build commands, and deploy it.
Once done, you’ll see a live URL (like https://main.branchname.amplifyapp.com
)
Step 5: Add Custom Domain (Optional)
In Amplify Console, go to Domain Management
Click Add Domain
Choose your domain (must be registered with Route 53 or elsewhere)
Configure subdomains (e.g.,
www
orapp
)Amplify will handle SSL setup automatically
Step 6: Add Environment Variables (Optional)
You can set API keys, backend URLs, etc.:
Go to your Amplify app dashboard
Click on the Environment Variables section
Add key-value pairs
Trigger a redeploy for the changes to apply
Step 7: Enable Continuous Deployment
Every time you push to the selected branch in GitHub, Amplify will:
Pull the latest code
Rebuild the app
Deploy the new version live automatically
Bonus: Best Practices
Use
.env.production
for production variablesEnable Amplify’s branch previews for feature branches
Use Amplify’s access control to password-protect environments
🧠 Summary
AWS Amplify makes hosting React apps incredibly easy:
Step | Description |
1 | Push code to GitHub |
2 | Connect GitHub repo in Amplify |
3 | Configure build & deploy |
4 | Add domain and env vars |
5 | Enjoy CI/CD out of the box |
📬 Need Help?
If you face any issues while hosting your Frontend app on AWS Amplify or have questions about CI/CD, custom domains, or GitHub integration — feel free to reach out!
📧 Contact Me: [khantanseer43@gmail.com]
Happy to help! 😊
Subscribe to my newsletter
Read articles from Tanseer Khan directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
