AWS SDK 또는 PutBucketAccelerateConfiguration CLI와 함께 사용 - AWS SDK 코드 예제

AWS 문서 AWS SDK 예제 리포지토리에 더 많은 SDK 예제가 있습니다. GitHub

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

AWS SDK 또는 PutBucketAccelerateConfiguration CLI와 함께 사용

다음 코드 예제는 PutBucketAccelerateConfiguration의 사용 방법을 보여줍니다.

.NET
AWS SDK for .NET
참고

더 많은 정보가 있습니다. GitHub AWS 코드 예제 리포지토리에서 전체 예제를 찾고 설정 및 실행하는 방법을 배워보세요.

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"); } } }
CLI
AWS CLI

버킷의 가속화 구성을 설정하려면

다음 put-bucket-accelerate-configuration 예시는 지정된 버킷에 대한 가속화 구성을 활성화합니다.

aws s3api put-bucket-accelerate-configuration \ --bucket my-bucket \ --accelerate-configuration Status=Enabled

이 명령은 출력을 생성하지 않습니다.

PowerShell
도구: PowerShell

예시 1: 이 명령은 지정된 S3 버킷의 전송 가속화를 활성화합니다.

$statusVal = New-Object Amazon.S3.BucketAccelerateStatus('Enabled') Write-S3BucketAccelerateConfiguration -BucketName 's3testbucket' -AccelerateConfiguration_Status $statusVal