Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 :)

like image 456
Jane S. Avatar asked Nov 18 '25 16:11

Jane S.


1 Answers

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.

like image 140
Michael - sqlbot Avatar answered Nov 21 '25 08:11

Michael - sqlbot



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!