Building a website using AWS S3 and delivering it through AWS cloudfront


This is Document will describe how to host a static website using amazon S3 and deliver it through AWS cloud front

Terms used in the document

Amazon simple storage service S3

Amazon cloud front

Amazon Route 53


This document contains screenshots of other documentation replace the buckets names according to your requirement

Creating Bucket In AWS


  • Login into the AWS console
  • Navigate S3 service
  • Create a bucket with same name of your Domain name

For example, if you domain is then create a bucket in AWS S3 as

  • In this case we creating bucket as
  • Select the bucket, navigate to properties and select to static web hosting


  • The console looks like


  • Select Use this bucket to host a website
  • Upload Index.html for home page
  • Upload error.html as error page (optional)
  • Ensure that everything hosted in this must be permitted to use publicly
  • To achieve this, create a bucket policy
  • Click on permissions tab select bucket policy


  • Paste the following replacing with your own bucket name






“Principal”: “*”,







Create a Second bucket as

  • Create a second bucket as to redirect request from to
  • Select the create bucket and navigate to the properties and go to static web hosting section


  • Select Redirect request tab
  • Enter target bucket as (origin bucket)
  • This will redirect the requests from to
  • Click Save
  • Note the endpoint URLs for both buckets you will notice same output

Creating AWS cloud front distribution to improve website performance

  • Navigate to AWS cloudfront service
  • Create a web distribution select origin as your bucket


  • Make Restrict bucket access to yes
  • In Alternate CNAMES tab enter the bucket name
  • Click on create and wait for the distribution to deploy
  • Note the Domain name of Distribution like this


Linking our static website from cloud front to our Domain using AWS route 53 service

  • Navigate to Route53 service in AWS
  • Create a hosted zone as (replace with your domain name)
  • Copy the NS servers provided by AWS into your Domain Provider if your bought domain from vendors like GoDaddy, Digital ocean
  • Leave as defaults if your domain is registered in AWS
  • Create a record set as (replace with your domain name)
  • Select Alias to Yes
  • Enter the domain of cloud front distribution



Thus we created a static website using AWS S3 ,delivering it through cloud front and linking it to our Custom domain name

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s