これから書き溜めていく。
主にインスタンスの調査用に使用するAWS CLIコマンド類。
RDSの情報取得系
RDSのインスタンス名とMySQLのEngineVersionを引っ張る。
$ aws rds describe-db-instances | jq '.DBInstances[] |{DBInstanceIdentifier,EngineVersion}'
EC2の情報取得系
自分の作成したAMIイメージのNameと作成日を作成日順に逆順ソートして取得する。
- --owners selfで自分所有(作成)を指定。
- IAM環境なら同じ環境にいる人も含むっぽい。
- sort_by(Images,&CreationDate)でソート。
- トップツリーのImages内のCreationDateでソートかけているイメージ。
- たぶん↑の解釈は間違っている気がするので、どなたか教えてください
- トップツリーのImages内のCreationDateでソートかけているイメージ。
$ aws ec2 describe-images --owners self --query 'sort_by(Images,&CreationDate)[].{Name:Name,CreationDate:CreationDate}'
逆順ソートはこっち。reverse()で囲む。
$ aws ec2 describe-images --owners self --query 'reverse(sort_by(Images,&CreationDate)[].{Name:Name,CreationDate:CreationDate})'