简体   繁体   中英

How to get S3 endpoint using aws region in AWS cli?

I want to get the endpoint of a given region. Here is the link of the S3 regions and thier correspondiong endpoint.

Ex.

  • for us-east-1, the endpoint is s3.amazonaws.com,
  • for us-east-2, the endpoint is s3.us-east-2.amazonaws.com,
  • for us-east-2, the endpoint is s3.us-west-1.amazonaws.com, and so on...

Is there any way to get the endpoints via AWS cli? Thanks :)

There isn't an API for this.

If you like consistency, and a formula that should be valid for all regions going forward, then you might like this format:

s3.dualstack.${region}.amazonaws.com

All regions support this format, including us-east-1, and this endpoint is dual-stack, so it works with IPv4 and IPv6.

You can also prepend the bucket name and a dot to the beginning and have the individual bucket endpoint.

See the official list at Regions and Endpoints .

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