Every object stored in Amazon S3 is contained in a bucket. Buckets partition the namespace of objects stored in Amazon S3 at the top level. Within a bucket, you can use any names for your objects, but bucket names must be unique across all of Amazon S3.
Buckets are similar to Internet domain names. Just as Amazon is the only owner of the domain name Amazon.com, only one person or organization can own a bucket within Amazon S3. Once you create a uniquely named bucket in Amazon S3, you can organize and name the objects within the bucket in any way you like and the bucket will remain yours for as long as you like and as long as you have the Amazon S3 account.
The similarities between buckets and domain names is not a coincidence—there is a
direct mapping between Amazon S3 buckets and subdomains of s3.amazonaws.com. Objects stored in Amazon S3 are
addressable using the REST API under the domain
bucketname
.s3.amazonaws.com. For example, if the object
homepage.html
is stored in the Amazon S3 bucket mybucket
its
address would be http://mybucket.s3.amazonaws.com/homepage.html
. For more information,
see Virtual Hosting of Buckets.
To determine whether a bucket name exists using REST, use HEAD
, specify the
name of the bucket, and set max-keys
to 0. To determine whether a bucket name
exists using SOAP, use ListBucket
and set MaxKeys
to 0. A
NoSuchBucket response indicates that the bucket is available, a AccessDenied response
indicates that someone else owns the bucket, and a Success response indicates that you own
the bucket or have permission to access it.