AWS SDK 또는 CLI와 함께 GetBucketReplication 사용
다음 코드 예시는 GetBucketReplication의 사용 방법을 보여 줍니다.
- CLI
-
- AWS CLI
-
다음 명령은 이름이
amzn-s3-demo-bucket인 버킷의 복제 구성을 검색합니다.aws s3api get-bucket-replication --bucketamzn-s3-demo-bucket출력:
{ "ReplicationConfiguration": { "Rules": [ { "Status": "Enabled", "Prefix": "", "Destination": { "Bucket": "arn:aws:s3:::amzn-s3-demo-bucket-backup", "StorageClass": "STANDARD" }, "ID": "ZmUwNzE4ZmQ4tMjVhOS00MTlkLOGI4NDkzZTIWJjNTUtYTA1" } ], "Role": "arn:aws:iam::123456789012:role/s3-replication-role" } }-
API 세부 정보는 AWS CLI 명령 참조의 GetBucketReplication
을 참조하세요.
-
- Java
-
- SDK for Java 2.x
-
참고
GitHub에 더 많은 내용이 있습니다. AWS코드 예 리포지토리
에서 전체 예를 찾고 설정 및 실행하는 방법을 배워보세요. /** * Retrieves the replication details for the specified S3 bucket. * * @param s3Client the S3 client used to interact with the S3 service * @param sourceBucketName the name of the S3 bucket to retrieve the replication details for * * @throws S3Exception if there is an error retrieving the replication details */ public static void getReplicationDetails(S3Client s3Client, String sourceBucketName) { GetBucketReplicationRequest getRequest = GetBucketReplicationRequest.builder() .bucket(sourceBucketName) .build(); try { ReplicationConfiguration replicationConfig = s3Client.getBucketReplication(getRequest).replicationConfiguration(); ReplicationRule rule = replicationConfig.rules().get(0); System.out.println("Retrieved destination bucket: " + rule.destination().bucket()); System.out.println("Retrieved priority: " + rule.priority()); System.out.println("Retrieved source-bucket replication rule status: " + rule.status()); } catch (S3Exception e) { System.err.println("Failed to retrieve replication details: " + e.awsErrorDetails().errorMessage()); } }-
API 세부 정보는 AWS SDK for Java 2.x API 참조의 GetBucketReplication을 참조하세요.
-
- PowerShell
-
- Tools for PowerShell V4
-
예제 1: 이름이 'amzn-s3-demo-bucket'인 버킷에 설정된 복제 구성 정보를 반환합니다.
Get-S3BucketReplication -BucketName amzn-s3-demo-bucket-
API 세부 정보는 AWS Tools for PowerShell Cmdlet 참조(V4)의 GetBucketReplication을 참조하세요.
-
- Tools for PowerShell V5
-
예제 1: 이름이 'amzn-s3-demo-bucket'인 버킷에 설정된 복제 구성 정보를 반환합니다.
Get-S3BucketReplication -BucketName amzn-s3-demo-bucket-
API 세부 정보는 AWS Tools for PowerShell Cmdlet 참조(V5)의 GetBucketReplication을 참조하세요.
-
AWS SDK 개발자 가이드 및 코드 예제의 전체 목록은 AWS SDK를 사용하여 Amazon S3에서 개발을 참조하세요. 이 주제에는 시작하기에 대한 정보와 이전 SDK 버전에 대한 세부 정보도 포함되어 있습니다.
GetBucketPolicyStatus
GetBucketRequestPayment