0
votes

I followed quite a complicated AWS guide on setting a static hosting for my website, and it’s currently not loading, not sure why. What I have done:

  1. Created S3 bucket for the contents of the site estimate.dev
  2. Uploaded index.html to the root of the S3 bucket
  3. Unblocked all access to public in the "Prermissions -> Block Public Access" tab
  4. Added Bucket policy for public access:
    {
        "Version": "2012-10-17",
        "Id": "PolicyForPublicWebsiteContent",
        "Statement": [
            {
                "Sid": "PublicReadGetObject",
                "Effect": "Allow",
                "Principal": "*",
                "Action": "s3:GetObject",
                "Resource": "arn:aws:s3:::estimate.dev/*"
            }
        ]
    }
  1. Added “Static website hosting” feature pointing to the domain estimate.dev and index file index.html
  2. Added Route 53 zone for estimate.dev with auto-generated SOA and NS records. Set TTL of 60 seconds for each. Imag
  3. Added A record pointing to my S3 bucket (selected in combobox) Image
  4. Changed nameservers in my registrar's control panel to point to AWS nameservers listed in SOA record Image
  5. A day passed

Now the troubleshooting part:

  1. On my PC estimate.dev resolves to AWS IP (it was resolving Registrar IP 2 days ago)
  2. These urls perfectly return the contents of my website (just one page, index.html): http://estimate.dev.s3-website-us-east-1.amazonaws.com/ https://s3.amazonaws.com/estimate.dev/index.html
  3. These urls [http://estimate.dev] & [https://estimate.dev] return ERR_CONNECTION_TIMED_OUT in Chrome after loading for some time

I tried to delete A record and add a CNAME but it does not allow me to select my S3 bucket there. So I reverted back to A record.

What do I miss here?

1
You just need alias record and I think you already have it and it's working, the website is working on http because static website doesn't support https. curl -I estimate.dev HTTP/1.1 200 OK x-amz-id-2: KP4yTlvx3xGH10sMpUs0OgEDvsHFg7ID0yCmtzUDCDuiPt40DtwVqWKn7ueMbZfFb17WSOqmQKs= x-amz-request-id: DBE5A34D4D8ADF35 Date: Tue, 25 Jun 2019 13:43:28 GMT Last-Modified: Mon, 24 Jun 2019 16:41:46 GMT ETag: "7625d61cf4be9dbb1fac1275d2a0ffa3" Content-Type: text/html Content-Length: 1292 Server: AmazonS3James Dean
the problem isn't with Route53 and S3, many browsers uses HSTS and try for https which S3 website endpoint doesn't support, you need cloudfront for that. aws.amazon.com/premiumsupport/knowledge-center/…James Dean
I've just tried the "curl estimate.dev" on my cmd, and it works giving me the index.html contents, but neither estimate.dev not estimate.dev work in my browserv.karbovnichy
Yes, because browser is trying for https ()because of hsts policy) and S3 website endpoint doesn't support https and it gets timedout, try safari, it will load it on http.James Dean
Oh why does the tutorial even suggests to go this way that will not work in most modern browsers (facepalm)v.karbovnichy

1 Answers

1
votes

Everything is correct except S3 website endpoint (not the REST API) doesn't support HTTPS and many modern browsers tries for https because of HSTS policy and you'll see connection timeout.

To make it work on HTTPS, you can use CloudFront and set up using below link:

https://aws.amazon.com/premiumsupport/knowledge-center/cloudfront-serve-static-website/