

# AWS CLI および SDK for Java を使用して、S3 on Outposts バケットを取得する
<a name="S3OutpostsGetBucket"></a>

Amazon S3 on Outposts を使用すると、AWS Outposts で S3 バケットを作成し、ローカルデータアクセス、ローカルデータ処理、データレジデンシーを必要とするアプリケーション用に、オンプレミスのオブジェクトを簡単に保存および取得できます。S3 on Outposts は、新しいストレージクラス、S3 Outposts (`OUTPOSTS`) を提供し、これは Amazon S3 API を使用し、AWS Outposts 上の複数のデバイスやサーバー間でデータを永続的かつ冗長的に保存するように設計されています。仮想プライベートクラウド (VPC) を介したアクセスポイントとエンドポイント接続を使用して、Outposts バケットと通信します。Outposts バケットでは、Amazon S3 と同じ API と機能 (アクセスポリシー、暗号化、タグ付けなど) を使用できます。AWS マネジメントコンソール、AWS Command Line Interface (AWS CLI)、AWS SDK、または REST API を使用して S3 on Outposts を使用できます。詳細については、「[Amazon S3 on Outposts とは](S3onOutposts.md)」を参照してください。

以下の例は、AWS CLI と AWS SDK for Java を使用して、S3 on Outposts バケットを取得する方法を示しています。

**注記**  
AWS CLI または AWS SDK を通じて Amazon S3 on Outposts を使用する場合、バケット名の代わりに Outposts のアクセスポイント ARN を提供します。アクセスポイント ARN は次の形式になります。`region` は Outpost が属するリージョンの AWS リージョン コードです。  
`arn:aws:s3-outposts:region:123456789012:outpost/op-01ac5d28a6a232904/accesspoint/example-outposts-access-point`   
S3 on Outposts ARN の詳細については、「[S3 on Outposts のリソース ARN](S3OutpostsIAM.md#S3OutpostsARN)」を参照してください。

## の使用AWS CLI
<a name="S3OutpostsGetBucketCLI"></a>

次の S3 on Outposts の例では、AWS CLI を使用してバケットを取得します。このコマンドを使用するには、それぞれの `user input placeholder` をユーザー自身の情報に置き換えます。詳細については、「*AWS CLI リファレンス*」の「[get-bucket](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/s3control/get-bucket.html)」を参照してください。

```
aws s3control get-bucket --account-id 123456789012 --bucket "arn:aws:s3-outposts:region:123456789012:outpost/op-01ac5d28a6a232904/bucket/example-outposts-bucket"
```

## AWS SDK for Java の使用
<a name="S3OutpostsGetBucketJava"></a>

次の S3 on Outposts の例では、SDK for Java を使用してバケットを取得します。詳細については、「*Amazon Simple Storage Service API リファレンス*」の「[GetBucket](https://docs.aws.amazon.com/AmazonS3/latest/API/API_control_GetBucket.html)」を参照してください。

```
import com.amazonaws.services.s3control.model.*;

public void getBucket(String bucketArn) {

    GetBucketRequest reqGetBucket = new GetBucketRequest()
            .withBucket(bucketArn)
            .withAccountId(AccountId);

    GetBucketResult respGetBucket = s3ControlClient.getBucket(reqGetBucket);
    System.out.printf("GetBucket Response: %s%n", respGetBucket.toString());

}
```