HeadBucket을 사용하여 S3 on Outposts 버킷이 존재하고 버킷에 액세스할 수 있는 권한이 있는지 확인 - Amazon Simple Storage Service

HeadBucket을 사용하여 S3 on Outposts 버킷이 존재하고 버킷에 액세스할 수 있는 권한이 있는지 확인

객체는 Amazon S3 on Outposts에 저장되는 기본 개체입니다. 모든 객체는 어떤 버킷에 포함됩니다. Outpost 버킷의 객체에 액세스하려면 액세스 포인트를 사용해야 합니다. 객체 작업에 버킷을 지정할 때 액세스 포인트 이름이 포함된 액세스 포인트 Amazon 리소스 이름(ARN) 또는 액세스 포인트 별칭을 사용합니다. 액세스 포인트 별칭에 대한 자세한 내용은 S3 on Outposts 버킷 액세스 포인트에 버킷 스타일 별칭 사용 섹션을 참조하세요.

다음 예제는 S3 on Outposts 액세스 포인트에 대한 ARN 형식을 보여줍니다. 여기에는 Outpost가 있는 리전의 AWS 리전 코드, AWS 계정 ID, Outpost ID 및 액세스 포인트 이름이 포함됩니다.

arn:aws:s3-outposts:region:account-id:outpost/outpost-id/accesspoint/accesspoint-name

S3 on Outposts ARN에 대한 자세한 내용은 S3 on Outposts의 리소스 ARN 단원을 참조하세요.

참고

Amazon S3 on Outposts를 사용할 경우 객체 데이터는 항상 Outpost에 저장됩니다. AWS가 Outpost 랙을 설치하는 경우 데이터 상주 요구 사항을 충족하기 위해 데이터가 Outpost에 로컬로 유지됩니다. 객체는 Outpost에서 벗어나지 않으며 AWS 리전에 있지 않습니다. AWS Management Console이 리전 내에 호스팅되므로 콘솔을 사용하여 Outpost의 객체를 업로드하거나 관리할 수 없습니다. 그러나 REST API, AWS Command Line Interface(AWS CLI), AWS SDK를 사용하여 액세스 포인트를 통해 객체를 업로드하고 관리할 수 있습니다.

다음 AWS Command Line Interface(AWS CLI) 및 AWS SDK for Java 예제에서는 HeadBucket API 작업을 사용하여 Amazon S3 on Outposts 버킷이 존재하고 버킷에 액세스할 수 있는 권한이 있는지를 확인하는 방법을 보여줍니다. 자세한 내용은 Amazon Simple Storage Service API 참조HeadBucket를 참조하세요.

다음 S3 on Outposts AWS CLI 예제에서는 head-bucket 명령을 사용하여 버킷이 존재하고 버킷에 액세스할 수 있는 권한이 있는지를 확인합니다. 이 명령을 사용하려면 각 user input placeholder를 사용자의 정보로 대체합니다. 이 명령에 대한 자세한 내용은 AWS CLI 참조head-bucket을 참조하세요.

aws s3api head-bucket --bucket arn:aws:s3-outposts:region:123456789012:outpost/op-01ac5d28a6a232904/accesspoint/example-outposts-access-point

다음 S3 on Outposts 예제에서는 버킷이 존재하고 버킷에 액세스할 수 있는 권한이 있는지 확인하는 방법을 보여줍니다. 이 예제를 사용하려면 Outpost에 대한 액세스 포인트 ARN을 지정합니다. 자세한 내용은 Amazon Simple Storage Service API 참조HeadBucket를 참조하세요.

import com.amazonaws.AmazonServiceException; import com.amazonaws.SdkClientException; import com.amazonaws.services.s3.AmazonS3; import com.amazonaws.services.s3.AmazonS3ClientBuilder; import com.amazonaws.services.s3.model.HeadBucketRequest; public class HeadBucket { public static void main(String[] args) { String accessPointArn = "*** access point ARN ***"; try { // This code expects that you have AWS credentials set up per: // https://docs.aws.amazon.com/sdk-for-java/v1/developer-guide/setup-credentials.html AmazonS3 s3Client = AmazonS3ClientBuilder.standard() .enableUseArnRegion() .build(); s3Client.headBucket(new HeadBucketRequest(accessPointArn)); } catch (AmazonServiceException e) { // The call was transmitted successfully, but Amazon S3 couldn't process // it, so it returned an error response. e.printStackTrace(); } catch (SdkClientException e) { // Amazon S3 couldn't be contacted for a response, or the client // couldn't parse the response from Amazon S3. e.printStackTrace(); } } }