晴耕雨読

working in the fields on fine days and reading books on rainy days

AWS CLIでバケットを作成する方法

AWS CLIでは、S3 APIのcreate-bucket APIを利用することで、S3にバケットを作成することができます。 サブコマンドs3apiのcreate-bucketメソッドを使用してバケットを作成するには、AWS CLIでAWS S3リソースへのアクセスが許可されたアクセスキーを設定 or IAMロールの割り当てをした後に、以下のコマンドを実行します。

なお、引数 –bucket には作成したいバケット名、引数 –region と –create-bucket-configuration にはバケットを配置するリージョン名を指定します。

$ aws s3api create-bucket --bucket BUCKETNAME --region ap-northeast-1 \
  --create-bucket-configuration LocationConstraint=ap-northeast-1

出力結果:

{
    "Location": "http://BUCKETNAME.s3.amazonaws.com/"
}

以上です。

参考文献