List public IP addresses of EC2 instances using AWS CLI
Listing all public IP addresses of EC2 instances can be completed using the --query
argument.
1aws ec2 describe-instances \
2 --query "Reservations[*].Instances[*].PublicIpAddress" \
3 --output text