Bootstrap FreeKB - Amazon Web Services (AWS) - List EC2 IP Addresses using the AWS CLI
Amazon Web Services (AWS) - List EC2 IP Addresses using the AWS CLI


This assumes you have already configured the aws command line tool. If not, check out my article on Getting Started with the AWS CLI.

The aws ec2 describe-addresses command can be used to return JSON that lists the IP addresses associated with your EC2 instances.

aws ec2 describe-addresses

 

And here is an example of how to limit the output using the --query option.

aws ec2 describe-addresses --query 'Addresses[?PublicIp==`107.14.151.201`]'

 

In this example, some configurations have been set.

{
    "Addresses": [
        {
            "PublicIp": "107.14.151.201",
            "AllocationId": "eipalloc-08f7123469aafbabf",
            "AssociationId": "eipassoc-0d1c511234ba5abab",
            "Domain": "vpc",
            "NetworkInterfaceId": "eni-03c87e123420abab3",
            "NetworkInterfaceOwnerId": "954001234672",
            "PrivateIpAddress": "10.25.10.7",
            "Tags": [
                {
                    "Key": "Name",
                    "Value": "My EC2 Instance"
                }
            ],
            "PublicIpv4Pool": "amazon",
            "NetworkBorderGroup": "us-east-2"
        }
    ]
}

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 48baa7 in the box below so that we can be sure you are a human.