How do I include an S3 bucket name and region/endpoint in a single URL?

后端 未结 3 932
醉梦人生
醉梦人生 2021-02-08 06:54

If I have a bucket named mybucket in region=us-east-1, then I can access it using

aws s3 ls s3://mybucket --region=us-east-1

3条回答
  •  感情败类
    2021-02-08 07:53

    The proper way to include the S3 region for a bucket is to include it in the URL properly.

    Note: "s3.amazonaws.com" is often mis-used when referencing buckets in regions outside of us-east-1. It can be, and often is used to do so. But, doing so makes knowing which region you are actually operating in less obvious, and this can be problematic in some scenerios.

    If you wanted to specifically reference a bucket called "mybucket" in us-east-2 then the best way to do this is one of the following:

    Host-Style Naming: http://mybucket.s3-us-west-2.amazonaws.com
    Path-Style Naming: http://s3-us-west-2.amazonaws.com/mybucket
    

    In either one of those examples, you will always connect to us-west-2 when referencing "mybucket".

提交回复
热议问题