LoginSignup
0
0

More than 3 years have passed since last update.

AWS cli個人的メモ

Last updated at Posted at 2020-05-21

可変の部分は基本的にhogeにしておきます。コマンド例のhogeを自分が使いたいものに変更すれば使えます。

IAM

ユーザー一覧取得

aws iam list-users

EC2

EC2インスタンス

オートスケーリンググループ名 "hoge" のインスタンスのプライベートIP取得

aws ec2 describe-instances --region=ap-northeast-1 \
--filters \
"Name=tag-key,Values=aws:autoscaling:groupName" \
"Name=tag-value,Values=hoge" \
--query "Reservations[].Instances[].PrivateIpAddress" 

EBSボリューム

Nameなしで使われていないやつを取得

aws ec2 describe-volumes --query 'Volumes[?!not_null(Tags[?Key == `Name`].Value)]' --filters "Name=status,Values=available"

S3

バケットの中で再帰的に一番新しいオブジェクトを探す

aws s3 ls --recursive s3://hoge-bucket | sort -nr | head -n 1

"hoge"バケットのバージョニングを有効にする

aws s3api put-bucket-versioning --bucket hoge --versioning-configuration Status=Enabled

"hoge"バケットのバージョニング設定を確認

aws s3api get-bucket-versioning --bucket hoge

Route 53

ホストゾーンを確認

aws route53 list-hosted-zones

ホストゾーンID"hoge"にあるレコードセット確認

https://qiita.com/ryuseino/items/223743187e3769847231#%E3%83%9B%E3%82%B9%E3%83%88%E3%82%BE%E3%83%BC%E3%83%B3%E3%82%92%E7%A2%BA%E8%AA%8D
このコマンドの結果で取得できるようなホストゾーンIDを使う。先頭は固定で "/hostedzone/" になっているようだ

aws route53 list-resource-record-sets --hosted-zone-id /hostedzone/hoge

ホストゾーンID "hoge" にあって、Nameに "hoge"が入っているレコード確認

aws route53 list-resource-record-sets --hosted-zone-id /hostedzone/hoge --query "ResourceRecordSets[?contains(Name,'hoge')]"
0
0
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
0
0