The cloud is perfect for hosting static websites that only include HTML, CSS, and JavaScript files that require no server-side processing. In this project, you will deploy a static website to AWS. First, you will create an S3 bucket, configure the bucket for website hosting, and secure it using IAM policies. Next, you will upload the website files to your bucket and speed up content delivery using AWS’s content distribution network service, CloudFront. Lastly, you will access your website in a browser using the unique S3 endpoint.
Architecture Diagram for static website hosting on AWS (using the following services - S3, CDN, Route 53)
- Search for S3 services in AWS serach bar click on "S3" Look below screenshot
- It will open up S3 console like this:
-
Now, select on "Create bucket" on the console, it will open up new window like below:
Here fill out the below list out required details to host a static webiste :
- Bucket Name
- Uncheck "Block Public Access for this bucket"
- Check " I acknowlegde ........"
- Then, select create button at last
New window will open like this:
-
After, bucket gets created then go to "properties" inside that go to "Static website hosting" and change the settings to "enable" and mention the index.html file there.
-
Now, Go to Permissions and edit the bucket policy then copy and paste the below bucket policy.
-
Now, create CDN endpoint by going to Cloudfront console. Click on Create a Cloudfront distribution
-
And then fill out the values such as :
-
origin
-
choose Redirect http to https
-
choose no WAF
-
then click on create distribution
- wait for 4-5 min to be get the endpoint created. You will see below message.
- After endpoint gets created go to browser and open the endpoint. It will open your hosted website.
-Put /index.html at last to access your website