How to get a list of AWS EIP addresses from the command line?
Asked Answered
G

2

8

I have a use case where I would like to run a script using all existing elastic IP addresses in a specific VPC.

Any thoughts on the best way to generate that list?

I've been looking through the AWS CLI documentation and can't find anything.

Thanks in advance!

Goggles answered 13/10, 2017 at 17:27 Comment(0)
D
16

The command you are looking for (which is certainly difficult to find due to the unintuitive name) is:

aws ec2 describe-addresses
Dazzle answered 13/10, 2017 at 17:37 Comment(2)
Cheers and thank you! But our princess is in another castle. :-) Your link points to the "latest" however it brings up CLI v1 (good job there, Amazon) Here is the v2 doc page: awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/…Buckjumper
That's the latest documentation for the CLI v1, which was probably the only version of the CLI back when I answered this question in 2017.Dazzle
J
20

@Mark's answer is correct. I am just extrapolating the exact command to list the elastic ip's.

aws ec2 describe-addresses --region us-east-1 --query 'Addresses[*].PublicIp'
Jeniferjeniffer answered 13/10, 2017 at 18:32 Comment(0)
D
16

The command you are looking for (which is certainly difficult to find due to the unintuitive name) is:

aws ec2 describe-addresses
Dazzle answered 13/10, 2017 at 17:37 Comment(2)
Cheers and thank you! But our princess is in another castle. :-) Your link points to the "latest" however it brings up CLI v1 (good job there, Amazon) Here is the v2 doc page: awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/…Buckjumper
That's the latest documentation for the CLI v1, which was probably the only version of the CLI back when I answered this question in 2017.Dazzle

© 2022 - 2024 — McMap. All rights reserved.