using lightsail DNS to host static wbesite on S3

0

I know S3 can be used for static hosting. I have a domain and dns zone in lightsail. How do I point my domain to the S3 bucket? I don't want to move the dns zone to Rout53 because lightsail DNS is free. Is this possible?

yoel
asked a year ago550 views
1 Answer
1
Accepted Answer

Hi Yoel,

You can configure the S3 static website hosting using your own customer domain with LightSail DNS, the process is very similar to when using R53, you just need to follow the below steps:

Lets say you have a domain named: example.com

  1. Create an S3 bucket with a subdomain, e.g "www.example.com" - for the apex you will need to use R53 Alias records.
  2. On the S3 console, go to the bucket, Properties, "Static website hosting", edit.
  3. Select "Enable", input your index document and Save.
  4. Scroll down and take note of the S3 static website endpoint (without the bucket name), should be something like "s3-website-{region).amazonaws.com" - more details on the endpoint per region on the link
  5. Under LightSail, select "Domains & DNS", select your domain zone and under "DNS records" add a new record.
    • Record type: CNAME

    • Record name: www (so it becomes www.example.com)

    • Route traffic to: Input your static website endpoint, e.g "s3-website-eu-west-1.amazonaws.com" for a bucket in Ireland, Save.

    • Your should have something like: Enter image description here

Having done the above and once you have a bucket policy that allows public Read (s3:GetObject) from your bucket, you can now use your custom domain to access your website hosted on S3.

Note: S3 static websites are only available through HTTP, if you would like to use HTTPS, use Amazon CloudFront to serve a static website hosted on Amazon S3 as explained on the link.

AWS
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions