Skip to content

Custom Domain and HTTPS

Set up Hosted Zone in Route 53

If you bought your domain in AWS you will already have a hosted zone so this section is mainly for users who purchased their domain elsewhere. If you did not purchase your domain with AWS you will want to create a hosted zone in AWS.

Click Create Hosted Zone and enter your domain example.com with type Public Hosted Zone.

Copy the ns values from your newly created hosted zone to nameserver settings for your domain.

Image S3 Static Index

Wherever you purchased your domains, you will want to edit the same servers and past the NS value from the AWS Hosted Zone.

Image S3 Static Index

AWS Certificate Manager (SSL Certs)

Ensure the us-east-1 region is selected as Cloud Front needs this (top right of dashboard). More info on this here https://aws.amazon.com/certificate-manager/faqs/

Image S3 Static Index

  • Add your domain example.com and your domain with the www subdomain www.example.com then click Next
  • Select DNS Validation then click Next
  • Click Review
  • Click Confirm and Request

Image S3 Static Index

  • Expand the area for each domain and click Create record in route53
  • Click Continue

AWS Cloud Front (CDN)

  • Click Create Distribution

Image S3 Static Index

  • Under Web click Get Started
  • Under Origin Domain Name enter the S3 Site Endpoint you made a note of earlier. It should be in the format bucket.name.s3-website-aws-region.amazonaws.com
  • Under Viewer Protocol Policy, select redirect http to https

  • Under Price class select use only US, Canada and Europe. Users outside these regions will experience more latency but this is cheaper

  • Under Alternate Domain Names (CNAMEs) enter your apex domain (example.com) and then on a new line enter your domain with the www subdomain (www.example.com)
  • Under SSL Certificate select Custom SSL Certificate and choose the Certificate we just created in AWS Certificate Manager
  • Under Default Root Object enter index.html
  • Click Create Distribution

Image S3 Static Index

This may take several minutes for the distribution to be created.

Route 53 (Route to Cloud Front)

  • Click Hosted Zones
  • Click your domain example.com
  • Click Create Record Set and leave name blank Set Alias to Yes Select Alias Target and select the Cloud Front deployment that we created earlier from the dropdown Click Create
  • Repeat as above but enter www as the name this time.

Image S3 Static Index

Image S3 Static Index

Your site should now be live under https://example.com and https://www.example.com

Comments