1
1

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.

awscliでEC2インスタンス操作関連でよく使うコマンド

Last updated at Posted at 2019-09-08

EC2インスタンス情報を取得する系コマンド

EC2インスタンス一覧

aws ec2 describe-instances

ID一覧

jsonストリームを加工するため、jqコマンドが必要

aws ec2 describe-instances | jq '.Reservations[].Instances[].InstanceId'

タグでフィルター

aws ec2 describe-instances --filter "Name=tag:Name,Values=ClowdWatch_test"

インスタンスIDを指定して取得

INSTANCEID='i-0219028c30d71bee2'
aws ec2 describe-instances --instance-ids ${INSTANCEID}

インスタンスIDとNameタグを取得

aws ec2 describe-instances | jq '.Reservations[].Instances[]|{InstanceId, Tags}'

AMI一覧

aws ec2 describe-images --owners self | jq '.Images[] | {Name, ImageId}'

キーペア一覧

aws ec2 delete-key-pairs

キーペア削除

aws ec2 delete-key-pair --key-name  master-key

セキュリティグループ一覧

aws ec2 describe-security-groups

セキュリティグループ削除

aws ec2 delete-security-group --group-name admin

参考

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?