LoginSignup
2
2

More than 5 years have passed since last update.

AWS CLIとjqコマンドを使ってec2インスタンス名・インスタンスタイプを列挙する方法

Last updated at Posted at 2016-06-29

結果がparseし易い形で出るので便利。

 % aws ec2 describe-instances --filters "Name=tag:Name,Values=momokuri-dev*" | jq ".Reservations[].Instances[] | [(.Tags | from_entries | .Name), .InstanceType]" | jq -c --slurp "sort | .[]"
["momokuri-dev-admin01","t2.medium"]
["momokuri-dev-admin02","t2.medium"]
["momokuri-dev-api01","t2.medium"]
["momokuri-dev-api02","t2.medium"]
["momokuri-dev-db-arbiter","t2.small"]
["momokuri-dev-db-primary","r3.large"]
["momokuri-dev-db-secondary","r3.large"]
["momokuri-dev-factory01","t2.medium"]
["momokuri-dev-search01","m4.large"]
["momokuri-dev-search02","m4.large"]
["momokuri-dev-search03","m4.large"]
2
2
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
2
2