Host a static website in AWS using cloud front CDN

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

  1. Log into your AWS account
  2. Upload the static website files to S3 bucket (you can refer to my previous if you don’t know how)
  3. Now search for Cloud Front in AWS search bar and navigate to Cloud Front
  4. Now click on create distribution
  5. Now click on get started
  6. Now select your AWS s3 bucket name to origin domain name field
  7. 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
  8. Now scroll down to distribution settings and mention index file name in default root object field
  9. Click on create distribution and wait for 5 mins for the distribution to be deployed you can check it in status tab
  10. 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.