简体   繁体   中英

Does the region need to be in an S3 domain?

When you navigate to a file uploaded on S3, you'll see its URL in a format such as this (eg in this example the bucket name is example and the file is hello.txt ):

https://example.s3.us-west-2.amazonaws.com/hello.txt

Notice that the region, us-west-2 , is embedded in the domain.

I accidentally tried accessing the same url without the region, and noticed that it worked too:

https://example.s3.amazonaws.com/hello.txt

It seems much simpler to use these shorter URLs rather than the longer ones as I don't need to pass around the region.

Are there any advantages/disadvantages of excluding the region from the domain? Or are the two domains the same?

This is a deprecated feature of Amazon S3 known as Global Endpoints . Some regions support the global endpoint for backward compatibility purposes. AWS recommends that you use the standard endpoint syntax in the future.

For regions that support the global endpoint, your request is redirected to the standard endpoint. By default, Amazon routes global endpoint requests to the us-east-1 region. For buckets that are in supported regions other than us-east-1, Amazon S3 updates the DNS record for future requests (note that DNS updates require 24-48 hours to propagate). Amazon then redirects the request to the correct region using the HTTP 307 Temporary Redirect.

Are there any advantages/disadvantages of excluding the region from the domain? Or are the two domains the same?

  • The domains are not the same.
  • Advantages to using the legacy global endpoint: the URL is shorter.
  • Disadvantages: the request must be redirected and is, therefore, less efficient. Further, if you create a bucket in a region that does not support global endpoints, AWS will return an HTTP 400 Bad Request error response.

TLDR: It is a best practice to use the standard (regional) S3 endpoint syntax.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM