Use PutBucketAccelerateConfiguration with an Amazon SDK or command line tool - Amazon Simple Storage Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Use PutBucketAccelerateConfiguration with an Amazon SDK or command line tool

The following code example shows how to use PutBucketAccelerateConfiguration.

.NET
Amazon SDK for .NET
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the Amazon Code Examples Repository.

using System; using System.Threading.Tasks; using Amazon.S3; using Amazon.S3.Model; /// <summary> /// Amazon Simple Storage Service (Amazon S3) Transfer Acceleration is a /// bucket-level feature that enables you to perform faster data transfers /// to Amazon S3. This example shows how to configure Transfer /// Acceleration. /// </summary> public class TransferAcceleration { /// <summary> /// The main method initializes the client object and sets the /// Amazon Simple Storage Service (Amazon S3) bucket name before /// calling EnableAccelerationAsync. /// </summary> public static async Task Main() { var s3Client = new AmazonS3Client(); const string bucketName = "doc-example-bucket"; await EnableAccelerationAsync(s3Client, bucketName); } /// <summary> /// This method sets the configuration to enable transfer acceleration /// for the bucket referred to in the bucketName parameter. /// </summary> /// <param name="client">An Amazon S3 client used to enable the /// acceleration on an Amazon S3 bucket.</param> /// <param name="bucketName">The name of the Amazon S3 bucket for which the /// method will be enabling acceleration.</param> private static async Task EnableAccelerationAsync(AmazonS3Client client, string bucketName) { try { var putRequest = new PutBucketAccelerateConfigurationRequest { BucketName = bucketName, AccelerateConfiguration = new AccelerateConfiguration { Status = BucketAccelerateStatus.Enabled, }, }; await client.PutBucketAccelerateConfigurationAsync(putRequest); var getRequest = new GetBucketAccelerateConfigurationRequest { BucketName = bucketName, }; var response = await client.GetBucketAccelerateConfigurationAsync(getRequest); Console.WriteLine($"Acceleration state = '{response.Status}' "); } catch (AmazonS3Exception ex) { Console.WriteLine($"Error occurred. Message:'{ex.Message}' when setting transfer acceleration"); } } }

For a complete list of Amazon SDK developer guides and code examples, see Using this service with an Amazon SDK. This topic also includes information about getting started and details about previous SDK versions.