0
0

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] インスタンスタイプごとの台数を出力する運用ワンライナー

Posted at

概要

  • メモ
  • インスタンスタイプごとに何台立っているかを集計するワンライナー
  • RI買ったりするときの参考に

前提条件

  • aws cliがインストールされている
  • jqが使える

方法

Command
aws ec2 describe-instances \
  --query 'Reservations[].Instances[].InstanceType | sort(@)' |
  jq -r 'group_by(.) | map({(.[0]): length})[]' |
  tr -d {} |
  tr -d \" |
  tr -d ,  |
  sed -e 's/:/,/g' | 
  grep -v '^\s*$'
結果
  t2.micro, 3
  t2.nano, 1
  t2.small, 7
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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?