How does Amazon S3 endpoints work ?

Greg
2 min readJun 11, 2023

--

Here is a quick example of some requests to the Amazon S3 service that could help you understand how the service endpoints work.

  1. Some S3 operations can be sent to any AWS regions
  2. Some S3 operations have to be sent to the correct AWS region

1) Some S3 operations can be sent to any AWS regions

Let’s try to list the names of all the buckets in my AWS account by specifying different AWS regions each time.

aws s3 ls — region eu-west-3 — debug |& grep HTTP

The S3 service in the region eu-west-3 returns a 200 response

Let’s try to use another region such as São Paulo for the same command:

aws s3 ls — region sa-east-1 — debug |& grep HTTP

The S3 service in the region sa-east-1 returns a 200 response

Let’s try to use another region such as Frankfurt for the same command:

aws s3 ls — region sa-east-1 — debug |& grep HTTP

The S3 service in the region eu-central-1 returns a 200 response

2) Some S3 operations have to be sent to the correct AWS region

Now if you are performing operations for objects (so inside a bucket), you will have to send the command to the right region (or you will get a redirect).

Let’s try to list the objects inside a bucket named “perm-bucket-special-delimiter” by using an incorrect region (my bucket is located in eu-west-1 and I will use eu-west-3 on purpose):

aws s3 ls s3://perm-bucket-special-delimiter — region eu-west-3 — debug |& grep HTTP

There is a 301 response to redirect to the correct AWS region (eu-west-1 in that case)

Key takeaways

All the AWS regions are able to respond to S3 API calls such as the ListBuckets operation (there might be some exceptions for AWS regions that you have not enabled or China).

You have to use the correct AWS region for bucket-specific operations (such as ListObject for instance).

--

--

Greg
Greg

No responses yet