AWS SDK Version 2 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

.NET Framework 3.5
 
Container for the parameters to the PutBucket operation.

Creates a new bucket.

Inheritance Hierarchy

System.Object
  Amazon.Runtime.AmazonWebServiceRequest
    Amazon.S3.Model.PutWithACLRequest
      Amazon.S3.Model.PutBucketRequest

Namespace: Amazon.S3.Model
Assembly: AWSSDK.dll
Version: (assembly version)

Syntax

C#
public class PutBucketRequest : PutWithACLRequest
         IRequestEvents

The PutBucketRequest type exposes the following members

Constructors

NameDescription
Public Method PutBucketRequest()

Properties

NameTypeDescription
Public Property BucketName System.String The name of the bucket to be created.
Public Property BucketRegion Amazon.S3.S3Region The region locality for the bucket.
Public Property BucketRegionName System.String The bucket region locality expressed using the name of the region. When set, this will determine where your data will reside in S3. Valid values: us-east-1, us-west-1, us-west-2, eu-west-1, ap-southeast-1, ap-southeast-2, ap-northeast-1, sa-east-1
Public Property CannedACL Amazon.S3.S3CannedACL The canned ACL to apply to the bucket.
Public Property Grants System.Collections.Generic.List<Amazon.S3.Model.S3Grant> Gets the access control lists (ACLs) for this request. Please refer to S3Grant for information on S3 Grants.
Public Property UseClientRegion System.Boolean If set to true the bucket will be created in the same region as the configuration of the AmazonS3 client. If PutBucketRequest.BucketRegion or PutBucketRequest.BucketRegionName are set they take precedence over this property. Default: true.

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.

PutBucket 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);

                

Version Information

.NET Framework:
Supported in: 4.5, 4.0, 3.5

.NET for Windows Store apps:
Supported in: Windows 8.1, Windows 8

.NET for Windows Phone:
Supported in: Windows Phone 8.1, Windows Phone 8