How to Deploy A Static website on Amazon S3 Bucket.
3 min readJul 2, 2022
Prerequisites:
- AWS Account.
- Sample react app.
Step 1:
- Create a sample react app using the command — npx create-react-app
- Bundle the application as static using the command — npm run build
Step 2:
Create a S3 bucket on Aws, the name of the bucket should be the name of the desired website.
Two S3 bucket are created;
- www.awsdemoapp.io (main website)
- awsdemoapp.io (for redirect)
One would have the content of the website, while the other would be to redirect the main website.
- Upload the content of the website on the www.awsdemoapp.io bucket.
Enable the public access and the policy on the new bucket created.
- Enable the website by inserting the script in this link
- Enable static website hosting by clicking on properties, then include the index.html, then click save to update the changes.
Step 3:
The other bucket created awsdemoapp.io would be set up for redirect the default website.
- Enable the static website hosting on awsdemoapp.io s3 bucket
- Include the www.awsdemoapp.io to allow redirection to the main website and save changes.
Browse through the url http://www.awsdemoapp.io.s3-website-us-east-1.amazonaws.com/ to get the content of the website uploaded on s3 bucket.