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

后端 未结 3 937
醉梦人生
醉梦人生 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:32

    As @michael-sqlbot commented, URL and URI are not the same thing.

    The S3 URL you referenced is actually an S3Uri as mentioned here.

    AWS CLI - S3 Documentation

    S3Uri: represents the location of a S3 object, prefix, or bucket. This must be written in the form s3://mybucket/mykey where mybucket is the specified S3 bucket, mykey is the specified S3 key.

    Uniform Resource Identifier (URI)

    In information technology, a Uniform Resource Identifier (URI) is a string of characters used to identify a resource. Such identification enables interaction with representations of the resource over a network, typically the World Wide Web, using specific protocols. Schemes specifying a concrete syntax and associated protocols define each URI.

    Uniform Resource Locator (URL)

    A Uniform Resource Locator (URL), commonly informally termed a web address (a term which is not defined identically) is a reference to a web resource that specifies its location on a computer network and a mechanism for retrieving it. A URL is a specific type of Uniform Resource Identifier (URI), although many people use the two terms interchangeably.

    So what does this all mean? URL!=URI?

    According to the the definition of what a URI is, it is defined by the scheme designed for it. And, the scheme defined for it in this case, does not include a reference for region.

    So the format for the URI would be correct, even if viewed by others as incomplete.

    A URL is intended to help you locate an object somewhere, where as a URI is intended to reference an object and not necessarily locate it.

提交回复
热议问题