AWS SDK for .NET Documentation
PutBucket Method (request)
AmazonAmazon.S3AmazonS3ClientPutBucket(PutBucketRequest) Did this page help you?   Yes   No    Tell us about it...
Create a new S3 bucket.
Declaration Syntax
C#
public PutBucketResponse PutBucket(
	PutBucketRequest request
)
Parameters
request (PutBucketRequest)
The PutBucketRequest that defines the parameters of the operation.
Return Value
Returns a PutBucketResponse from S3.
Remarks

Depending on your latency and legal requirements, you can specify a location constraint that will affect where your data physically resides. 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. 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, the object homepage.html stored in the Amazon S3 bucket mybucket can be addressed as http://mybucket.s3.amazonaws.com/homepage.html.

To conform with DNS requirements, the following constraints apply:

  • Bucket names should not contain underscores (_)
  • Bucket names should be between 3 and 63 characters long
  • Bucket names should not end with a dash
  • Bucket names cannot contain two, adjacent periods
  • Bucket names cannot contain dashes next to periods (e.g., "my-.bucket.com" and "my.-bucket" are invalid)
  • Bucket names cannot contain uppercase characters

There is no limit to the number of objects that can be stored in a bucket and no variation in performance when using many buckets or just a few. You can store all of your objects in a single bucket or organize them across several buckets.

Examples

This example shows how to create a bucket in a specific region and with a canned ACL configuring the bucket to be public readable.

CopyPutBucket sample
// Create a client
AmazonS3Client client = new AmazonS3Client();

// Construct request
PutBucketRequest request = new PutBucketRequest
{
    BucketName = "SampleBucket",
    BucketRegion = S3Region.EU,         // set region to EU
    CannedACL = S3CannedACL.PublicRead  // make bucket publicly readable
};

// Issue call
PutBucketResponse response = client.PutBucket(request);
Exceptions
See Also

Assembly: AWSSDK (Module: AWSSDK) Version: 1.5.60.0 (1.5.60.0)