Skip to content

Instantly share code, notes, and snippets.

@shiro01
Last active September 18, 2019 06:23
Show Gist options
  • Save shiro01/71d654f5a1ceed4e39eaab58c4d58ad9 to your computer and use it in GitHub Desktop.
Save shiro01/71d654f5a1ceed4e39eaab58c4d58ad9 to your computer and use it in GitHub Desktop.
AWS CLIのサンプル。
centosへのインストール(Python3がインストールされていること)
https://docs.aws.amazon.com/ja_jp/cli/latest/userguide/cli-chap-install.html
$ pip3 install awscli --upgrade --user
コンフィグ設定
aws configure --profile dev
AWS Access Key ID [None]: hogehoge
AWS Secret Access Key [None]: hogehoge
Default region name [None]: ap-northeast-1
Default output format [None]: json
コンフィグ設定確認
aws configure list [--profile profile-name]
aws configure list --profile dev
AWS Account ID確認
aws sts get-caller-identity --profile dev
ログエクスポートタスクの詳細取得
aws logs describe-export-tasks --task-id "task_id" --profile dev | jq
ログエクスポートタスクのキャンセル
aws logs cancel-export-task --task-id "task_id" --profile dev | jq
特定ステータスのログエクスポートタスクを表示
aws logs describe-export-tasks --status-code "PENDING" --profile dev | jq
S3のオブジェクトとフォルダ情報を取得する。
aws s3 ls s3://my-s3-bucket --profile dev
再帰的にS3のオブジェクトとフォルダ情報を取得する。
aws s3 ls s3://my-s3-bucket --recursive --profile dev
s3にファイルをアップロード
aws s3 cp ./a/a.json s3://my-s3-bucket/sample001/a/ --profile dev
aws s3 cp ./b/b.json s3://my-s3-bucket/sample001/b/ --profile dev
アップロードしたファイルの確認
aws s3 ls s3://my-s3-bucket/sample001/a/a.json --profile dev
aws s3 ls s3://my-s3-bucket/sample001/a/b.json --profile dev
# Amazon SNS メール通知の「unsubscribe」リンクを無効化(メールのリンクに飛ばずに実行すること)
# サブスクリプション確認メールのリンク(「Confirm subscription」)内容から必要な情報を埋める。
aws sns confirm-subscription --topic-arn arn:aws:sns:ap-northeast-1:xxxxxxxx:topic_name --token hogehoge --authenticate-on-unsubscribe true --region ap-northeast-1 --profile dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment