Doc AWS SDK 예제 GitHub 리포지토리에서 사용할 수 있는 SDK 예제가 더 많습니다. AWS
기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
AWS SDK 또는 CLI와 GetBucketReplication
함께 사용
다음 코드 예제는 GetBucketReplication
의 사용 방법을 보여 줍니다.
- CLI
-
- AWS CLI
-
다음 명령은
my-bucket
이라는 버킷의 복제 구성을 가져옵니다.aws s3api get-bucket-replication --bucket
my-bucket
출력:
{ "ReplicationConfiguration": { "Rules": [ { "Status": "Enabled", "Prefix": "", "Destination": { "Bucket": "arn:aws:s3:::my-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
-
- PowerShell용 도구
-
예시 1: 이름이 'mybucket'인 버킷에 설정된 복제 구성 정보를 반환합니다.
Get-S3BucketReplication -BucketName amzn-s3-demo-bucket
-
API 세부 정보는 AWS Tools for PowerShell Cmdlet 참조의 GetBucketReplication을 참조하세요.
-
GetBucketPolicyStatus
GetBucketRequestPayment