LoginSignup
4
7

More than 5 years have passed since last update.

AWS EC2 で取得しているグローバルIP(Elastic IP)を CLI で一覧する

Last updated at Posted at 2015-11-30

手順

aws-cli と jq を使えば、以下のように改行区切りで取得できる.

$ aws ec2 describe-addresses | jq '.[] | .[] | .PublicIp' | sed 's/\"//g'
xxx.xxx.xxx.xxx
yyy.yyy.yyy.yyy
zzz.zzz.zzz.zzz

別解

コメント欄で教えてもらった以下の方法だと、 jq を使わないでもいける.

$ aws ec2 describe-addresses --query '*[].PublicIp' --output text | tr '\t' '\n'

参考

4
7
2

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