Deploy a Create React App SPA on AWS
You can deploy a Create React App site on AWS in under a minute. Your site is served over a lightning-fast global CDN, comes with fully managed TLS certificates, and supports custom domains out of the box.
-
Use your existing React repository.
-
Create a new Application on Thunder, and give Thunder permission to access your new repo.
-
Use the following values during creation:
Parameter | Value |
---|---|
Install Command | npm install |
Build Command | npm run build |
Output Directory | build |
That’s it! Your app will be live on your CloudFront URL as soon as the build finishes.
Use Client-side Routing
If you use Reach Router or React Router for client-side routing, you will need to direct all routing requests to index.html
so they can be handled by your routing library.
You can do this easily by defining a Redirect Rule for your site. Go to the Redirects section for your app settings and add a rule with the following values:
Parameter | Value |
---|---|
Source Path | /* |
Destination Path | /index.html |