객체 암호화를 업데이트하는 Batch Operations 작업 생성 - Amazon Simple Storage Service

객체 암호화를 업데이트하는 Batch Operations 작업 생성

단일 요청으로 둘 이상의 Amazon S3 객체의 서버 측 암호화 유형을 업데이트하려면 S3 Batch Operations를 사용합니다. Amazon S3 콘솔, AWS Command Line Interface(AWS CLI) AWS SDK 또는 Amazon S3 REST API를 통해 S3 Batch Operations를 사용할 수 있습니다.

다음 명령을 실행하려면 AWS CLI를 설치하고 구성해야 합니다. AWS CLI를 설치하지 않은 경우 AWS Command Line Interface 사용 설명서에서 최신 버전의 AWS CLI 설치 또는 업데이트를 참조하세요.

또는 AWS CloudShell을 사용하여 콘솔에서 AWS CLI 명령을 실행할 수 있습니다. AWS CloudShell은 브라우저 기반의 사전 인증된 쉘로, AWS Management Console에서 직접 시작할 수 있습니다. 자세한 내용은 AWS CloudShell 사용 설명서에서 CloudShell이란 무엇인가요?AWS CloudShell 시작하기를 참조하세요.

예 1 - 암호화된 객체를 한 AWS KMS key에서 다른 KMS 키로 업데이트하는 Batch Operations 작업 생성

다음 예제에서는 범용 버킷의 여러 객체에 대한 암호화 설정을 업데이트하는 S3 Batch Operations 작업을 생성하는 방법을 보여줍니다. 이 명령은 한 AWS Key Management Service(AWS KMS) 키로 암호화된 객체가 다른 KMS 키를 사용하도록 변경하는 작업을 생성합니다. 또한 이 작업은 영향을 받는 객체의 매니페스트를 생성 및 저장하고 결과 보고서를 생성합니다. 이 명령을 사용하려면 user input placeholders를 사용자의 정보로 대체합니다.

aws s3control create-job --account-id account-id \ --no-confirmation-required \ --operation '{"S3UpdateObjectEncryption": { "ObjectEncryption": { "SSEKMS": { "KMSKeyArn": "KMS-key-ARN-to-apply", "BucketKeyEnabled": false } } } }' \ --report '{ "Enabled": true, "Bucket": "report-bucket-ARN", "Format": "Report_CSV_20180820", "Prefix": "report", "ReportScope": "AllTasks" }' \ --manifest-generator '{ "S3JobManifestGenerator": { "ExpectedBucketOwner": "account-id", "SourceBucket": "source-bucket-ARN", "EnableManifestOutput": true, "ManifestOutputLocation": { "Bucket": "manifest-bucket-ARN", "ManifestFormat": "S3InventoryReport_CSV_20211130", "ManifestPrefix": "manifest-prefix" }, "Filter": { "MatchAnyObjectEncryption": [{ "SSEKMS": { "KmsKeyArn": "kms-key-ARN-to-match" } }] } } }' \ --priority 1 \ --role-arn batch-operations-role-ARN

최상의 성능을 위해 KmsKeyArn 필터를 MatchAnyPrefix, CreatedAfter 또는 MatchAnyStorageClass 등의 다른 객체 메타데이터 필터와 함께 사용하는 것이 좋습니다.

예 2 - SSE-S3로 암호화된 객체를 SSE-KMS로 업데이트하는 Batch Operations 작업 생성

다음 예제에서는 범용 버킷의 여러 객체에 대한 암호화 설정을 업데이트하는 S3 Batch Operations 작업을 생성하는 방법을 보여줍니다. 이 명령은 Amazon S3 관리형 키를 통한 서버 측 암호화(SSE-S3)를 사용하여 암호화된 객체가 AWS Key Management Service (AWS KMS) 키를 통한 서버 측 암호화(SSE-KMS)를 사용하도록 변경하는 작업을 생성합니다. 또한 이 작업은 영향을 받는 객체의 매니페스트를 생성 및 저장하고 결과 보고서를 생성합니다. 이 명령을 사용하려면 user input placeholders를 사용자의 정보로 대체합니다.

aws s3control create-job --account-id account-id \ --no-confirmation-required \ --operation '{"S3UpdateObjectEncryption": { "ObjectEncryption": { "SSEKMS": { "KMSKeyArn": "KMS-key-ARN-to-apply", "BucketKeyEnabled": false } } } }' \ --report '{ "Enabled": true, "Bucket": "report-bucket-ARN", "Format": "Report_CSV_20180820", "Prefix": "report", "ReportScope": "AllTasks" }' \ --manifest-generator '{ "S3JobManifestGenerator": { "ExpectedBucketOwner": "account-id", "SourceBucket": "source-bucket-ARN", "EnableManifestOutput": true, "ManifestOutputLocation": { "Bucket": "manifest-bucket-ARN", "ManifestFormat": "S3InventoryReport_CSV_20211130", "ManifestPrefix": "manifest-prefix" }, "Filter": { "MatchAnyObjectEncryption": [{ "SSES3": {} }] } } }' \ --priority 1 \ --role-arn batch-operations-role-ARN

최상의 성능을 위해 KmsKeyArn 필터를 MatchAnyPrefix, CreatedAfter 또는 MatchAnyStorageClass 등의 다른 객체 메타데이터 필터와 함께 사용하는 것이 좋습니다.