I cannot succesfully deploy my static website from S3.
I’ve followed AWS Guides, YouTube videos but nothing seems to work. Here’s my setup:
S3 buckets with names equal to my domain and (www.) subdomain.
If I try to go into the S3 website I can see my page:
www. subdomain bucket as redirect request as http
:
My hosted zone with properly created records (I believe)
Then changed my custom domains from domains.google.com
to fit the ones in the NS record from the Hosted Zone:
But when I try to go into my domain I get a TimeOut error…
Tutorials that I’ve followed:
-
https://docs.aws.amazon.com/AmazonS3/latest/userguide/website-hosting-custom-domain-walkthrough.html
If I try to edit the A records with my complete S3 website URL, this is what I see:
If I try to input it manually I get an error message:
3
Answers
Your Route53 DNS records value starts with
s3-website-...
– it looks like you omitted the unique prefix of the S3 website URL.Let’s assume:
example.com
test.example.com
http://test.example.com.s3-website.ap-south-1.amazonaws.com
Ensure below things:
test.example.com
, your subdomain should betest
, if your bucket name isexample.com
, leave the subdomain empty.Route traffic to
should match the region in your static site endpoint.s3-website.ap-south-1.amazonaws.com (test.example.com)
, and values3-website.ap-south-1.amazonaws.com
will be set if you choose that option.By following the above steps, you can resolve this issue.
The usual option is to combine S3 and Cloudfront, so that you get best global performance and also well named HTTPS URLs. This will also sort out permissions for you. It involves these steps:
For a walkthrough and further details, see my blog posts. There is a code sample there also, which might provide some useful hints. My scenario is a secured SPA though, so some of it may not be relevant to you.