DEV Community

Cover image for πŸš€ Hosting a React App on AWS Amplify with a Custom Domain
alok shankar
alok shankar

Posted on

πŸš€ Hosting a React App on AWS Amplify with a Custom Domain

πŸ“Œ 1. Introduction

In today’s fast-paced development world, hosting frontend applications with speed, scalability, and security is essential. If you’ve built a React app and want to deploy it quickly with CI/CD and HTTPS, AWS Amplify is a perfect solution. And the best part? You can access your app using your own custom domainβ€”even if it's hosted on third-party DNS provider like GoDaddy.

In this guide, I’ll walk through hosting a React app on AWS Amplify and linking it to a custom subdomain like https://subdomain.yourdomain.com.

🌐 2. Why Use AWS Amplify to Host Frontend Apps?

AWS Amplify is a full-stack hosting and deployment platform from AWS designed for modern web and mobile applications.

βœ… Benefits of AWS Amplify for Hosting Frontend Apps:

  1. - Zero server management
  2. - CI/CD integration with GitHub, GitLab, Bitbucket
  3. - Global CDN for faster content delivery
  4. - Free SSL certificate with automatic HTTPS
  5. - Custom domain support
  6. - Preview environments for every Git branch
  7. - Authentication, APIs, and storage if you expand to full-stack
  8. - It makes deployment as simple as connecting your GitHub repo and clicking "Deploy".

πŸ“¦ 3. Clone a Sample React App from GitHub
Let’s get started with a simple Tailwind CSS + React frontend.

πŸ“ Step-by-step:

# Clone the sample repo
git clone https://github.com/alokshanhbti/amplify-react-poc.git

cd amplify-react-poc

# Install dependencies
npm install

# Run locally
npm start

Enter fullscreen mode Exit fullscreen mode

Image description

Image description


## If you want to create your own React app:

npx create-react-app amplify-react-poc
cd amplify-react-poc

# Install TailwindCSS
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init -p

# Run the App Locally
npm start
Your app opens in your browser at http://localhost:3000

# Then push it to GitHub:
git init
git add .
git commit -m "Initial commit"
git branch -M main
git remote add origin https://github.com/YOUR_USERNAME/amplify-react-poc.git
git push -u origin main

Enter fullscreen mode Exit fullscreen mode

πŸ”— Summary GitHub Repo Structure

amplify-react-poc/
β”œβ”€β”€ public/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ App.js
β”‚   β”œβ”€β”€ index.css
β”‚   └── index.js
β”œβ”€β”€ tailwind.config.js
β”œβ”€β”€ postcss.config.js
β”œβ”€β”€ package.json
└── README.md

Enter fullscreen mode Exit fullscreen mode

πŸš€ 4. Deployment on AWS Amplify

🌍 Steps to Deploy:

Go to AWS Amplify Console
Click "Create New App"

Image description

Choose GitHub β†’ Connect your repo (amplify-react-poc)

Image description

Select the main branch and click Next

Image description

Image description

Amplify auto-detects React β†’ leave build settings as-is

Image description

Image description

Click "Save and Deploy"

Image description

Note : Please check build log if deployment failed.

Image description

There was error while build process. So verified the build.setting and checked amplify.yml file.

Image description

Added the commands under preBuild section


        - nvm install 20.19.0
        - nvm use 20.19.0
        - node -v  
        - npm install

Enter fullscreen mode Exit fullscreen mode

Post Update amplify.yml file

Image description

Image description

Deployment Completed

Image description

App accessible using amplify url

Image description

🌐 5. Add a Custom Domain (e.g., from GoDaddy)

Now let’s connect your Amplify app to a custom domain like https://subdomain.yourdomain.com.

To add a custom domain managed by a third-party DNS provider
Sign in to the AWS Management Console and open the Amplify console.

  • Choose your app that you want to add a custom domain to.
  • In the navigation pane, choose Hosting, Custom domains.
  • On the Custom domains page, choose Add domain.

Image description

Enter the name of your root domain. For example, if the name of your domain is https://example.com, enter example.com.

Image description

Amplify detects that you are not using a Route 53 domain and gives you the option to create a hosted zone in Route 53.

Image description

Once hosted zone created add those nameservers to your Domain provider.

Image description

Image description

Now add your subdomain and wait for DNS record be create for SSL creation

Image description

As my nameservers are changed to Route53 then we don’t have to do anything Amplify will add these records to route 53

Image description

Image description

Domain activation completed

Image description

πŸ”“ 6. Access the App Using Custom Domain

After DNS propagation and SSL verification (usually < 1 hour):

βœ… Your app will be available at:

https://subdomain.yourdomain.com

Enter fullscreen mode Exit fullscreen mode

Image description

It will be fully secured with HTTPS using a free AWS-issued SSL certificate.

🧰 7. Troubleshooting Steps

πŸ”§ Problem                        βœ… Solution
❌ Domain verification failed      Ensure correct CNAME is added in GoDaddy
⏳ Stuck in "Pending"              Use https://dnschecker.org to confirm DNS
πŸ”’ No SSL/HTTPS                     Wait for Amplify to finish provisioning or re-add domain
πŸ›‘ 404 after deployment             Confirm the subdomain is correctly mapped to your app branch
Enter fullscreen mode Exit fullscreen mode

βœ… 8. Conclusion

Hosting a React app on AWS Amplify is fast, secure, and scalable. By combining it with your own custom domainβ€”whether it's registered on GoDaddy or any third-party DNS providerβ€”you get a professional-grade deployment pipeline in minutes.

No DevOps, no manual servers, and no complex SSL setups.

Just code β†’ push β†’ deploy

Top comments (0)