3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

【AWS】業務でよく使うAWS CLIまとめ

Last updated at Posted at 2018-07-17

プロファイル設定

aws configure --profile [プロファイル名]

プロファイル確認

aws --profile [プロファイル名] sts get-caller-identity

指定のEC2インスタンスの情報を表示

aws ec2 describe-instances --instance-ids [EC2インスタンスIDs] | jq '.Reservations[].Instances[] | {InstanceId, InstanceName: (.Tags[] | select(.Key=="Name").Value)}'

指定のEC2インスタンスを起動

aws ec2 start-instances --instance-ids [EC2インスタンスIDs] | jq '.StartingInstances[] | {InstanceId, CurrentState}'

指定のEC2インスタンスを停止

aws ec2 stop-instances --instance-ids [EC2インスタンスIDs]

指定のEC2インスタンスのAMIを取得

aws ec2 create-image --instance-id [EC2インスタンスIDs] --name [AMI名] --description [AMI説明] --no-reboot

Cloud WhatLogsからjson形式のパラメータのみを抽出

aws logs filter-log-events --log-group-name [ロググループ名] --filter-pattern [フィルタする文字列(エラーコードなど)] --start-time [ログ取得開始日時(ミリ秒数)] --end-time [ログ取得終了日時(ミリ秒数)] | jq -r '.events[].message'  | awk '{print substr($0, index($0, "{"))}' > リダイレクト先ファイル

S3 Bucketからフォルダごとコピー

$ aws s3 cp s3://[Bucket名]/[コピー元フォルダパス]/ [コピー先パス] --recursive
3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?