Hosting a static (https) web site on S3 using a custom domain name

In this blog, I will describe how I created a static web page for my static website.

Step 1: Create a certificate for https:

  • Set region to ‘US East (Virginia)’ (all certificates must be created in this region)
    In aws console: open the AWS Certificate Manager and choose ‘Provision Certificates’
  • Choose ‘request a public certificate’ and use ‘’ for the domain name
    • domain names:
    • klik next
    • choose a validation method: choose DNS validation
    • klik ‘review’
    • klik ‘confirm and request’
    • In the next page, you can see a pending state for each domain name. By opening the entry, you can see which DNS entry must be created to finish the validation process. These entries must be created by yourself on your DNS service provider.
      type: CNAME
      press ‘continue’ to finish the wizard
  • The state will be pending, but after a while this will be ‘issued’.

Step 2: Create an S3 bucket to store the web pages

  • Open S3 Management Console
  • Create a new bucket
    • Bucket name:
    • Ignore all other settings, press next until finished
  • In the ‘Properties page’ of the bucket: click on the ‘Static Website Hosting’ button and select ‘Use this bucket to host a website’, use ‘index.html’ as the index page and press save.
  • Open : permissions/bucket-policy and use the following value:
"Version": "2012-10-17",
"Statement": [
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "*"
  • Upload an index.html by dropping it on the ‘overview’ page

The page is now visible (but still without https) at:

Step 3: Enable https access:

  • Open the AWS cloudfront Console
  • Create distribution
    • use web delivery
    • Origin Domain Name :
    • Viewer Protocol Policy : Redirect HTTP to HTTPS
    • Alternate Domain Names :
    • Choose: “custom SSL certificate” and select the certificate that was created before
    • Default root object: index.html
    • click on ‘create distribution’
  • Check the status of the distribution, it may take a long time before the status is ‘Deployed’
  • Open the distribution, check the “General” details and search the ‘Domainname’ (e.x., this is needed for the next step

Step 4: Use a custom domain name:

  • Create a DNS entry in your own DNS service provider
    • DNS Name:
    • Type: CNAME
    • Value: (this is the Domainname as found in the previous step)

Step 5: Test the static website:
The webpage should now be visible at:

Step 6: Use aws cli to sync a local folder to S3:




Een gedachte over “Hosting a static (https) web site on S3 using a custom domain name

Reacties zijn gesloten.