I need the ability to query AWS to validate whether or not an Elastic IP is attached to an instance. This must be done via the command line or via script.
I have tried both Ansible and AWS CLI to try to obtain this information. Examples:
aws ec2 describe-addresses --filters Name='public-ip',Values=34.29.176.23
Error returned: HTTPSConnectionPool(host='ec2.us-west-2a.amazonaws.com', port=443): Max retries exceeded with url: / (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -2] Name or service not known',))
and using the Opsworks
aws opsworks describe-elastic-ips --ips '34.29.176.20'
Error returned: HTTPSConnectionPool(host='opsworks.us-west-2a.amazonaws.com', port=443): Max retries exceeded with url: / (Caused by NewConnectionError(': Failed to establish a new connection: [Errno -2] Name or service not known',))