AWS SDK Version 3 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.

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.S3.dll
Version: 3.x.y.z

Syntax

C#
public class PutBucketRequest : PutWithACLRequest
         IAmazonWebServiceRequest

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> Inherited from Amazon.S3.Model.PutWithACLRequest.
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 Standard:
Supported in: 1.3

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

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms

Unity:
Supported Versions: 4.6 and above
Supported Platforms: Android, iOS, Standalone