List all Public IP addresses in an AWS account

Want the list of all Public IP addresses associated with your Amazon Web Services account? Install aws-cli, configure, then:

aws ec2 describe-network-interfaces --query NetworkInterfaces[].Association.PublicIp

The result is a JSON array, so you can sort numerically with jq:

aws ec2 describe-network-interfaces --query NetworkInterfaces[].Association.PublicIp | jq 'sort_by(.)'
Tags: