In this article we will use Cloud Front CDN (Content Delivery Network) to host a static website. I will explain the advantage of using Cloud Front in later part of this article.
Let us first understand what is CDN? A CDN is a group of servers distributed geographically to deliver the internet content faster.
Cloud Front is a faster CDN service offered by AWS that delivers content with low latency and high transfer rate.
The following steps will help in hosting a static website using Cloud Front
- Log into your AWS account
- Upload the static website files to S3 bucket (you can refer to my previous article if you don’t know how)
- Now search for Cloud Front in AWS search bar and navigate to Cloud Front
- Now click on create distribution
- Now click on get started
- Now select your AWS s3 bucket name to origin domain name field
- If you have multiple folders in your bucket to your index html file copy the path (do not include index file in path) and paste it in origin path field
- Now scroll down to distribution settings and mention index file name in default root object field
- Click on create distribution and wait for 5 mins for the distribution to be deployed you can check it in status tab
- Once it is deployed copy the URL in domain name and use it to access your static website
Cloud Front speeds up content delivery by caching your content close to your end users and storing it in edge locations.