Chapter3
AWS CLIを使ってみる
AWSのS3に格納領域(Bucket)を作成し、以下のコマンドを入力
[bucketName="mybucket-$(openssl rand -hex 12)"]
[echo $bucketName]
[aws s3 mb "s3://${bucketName}"]
これらを実行することにより、ンダムな文字列を含んだバケットの名前を生成し、bucketNameという変数に格納される。
作成したバケットを確認するために以下を入力
[aws s3 ls]
次にバケットにファイルをアップロードするために以下を入力
[echo "Hello world!" > hello_world.txt]
[aws s3 cp hello_world.txt "s3://${bucketName}/hello_world.txt"]
以上を実行し、最後に使い終わったバケットを削除するために以下のコマンドを実行する。
[aws s3 rb "s3://${bucketName}" --force]