Why should the Amazon S3 store name match the website name when hosting a static website

I want to host a static website on S3, i.e. abcd.com. This requires a bucket name just like "abcd.com"

then I discovered that abcd.com was busy with other people.

So my question is: why should the byte name match the site name. because there is Route 53 to map the website to the endpoints of the bucket, this restriction is not required.

Is there a reason for this?

+6
source share
1 answer

The short answer is "that Amazon designed it."

If the bucket name does not match the domain name, how will S3 know which bucket to use to service requests for this domain?

You cannot say β€œRoute 53” because S3 was created before route 53, and website hosting in S3 works the same, even if you are not using Route 53 for DNS.

Similarly, it cannot be a configuration parameter in the bucket because it will simply create a new series of problems - if the previous owner of the domain still had your bucket configured with your domain, you would be exactly the same problem as you are now.

You can still host your site on S3, but with an inappropriate bucket name, you need either a reverse proxy in EC2 in the same region to rewrite the host header in each request to match the bucket name, or you can use CloudFront to achieve similar purpose, because then the name of the bucket should not match - CloudFront will also rewrite the Host header.

+4
source

Source: https://habr.com/ru/post/975393/


All Articles