Here is a quick example of some requests to the Amazon S3 service that could help you understand how the service endpoints work.
- Some S3 operations can be sent to any AWS regions
- 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
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
Let’s try to use another region such as Frankfurt for the same command:
aws s3 ls — region sa-east-1 — debug |& grep HTTP
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
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).