How to get the details which Instance is using particular Elastic IP (EIP)

dineshrathee12 profile image Dinesh Rathee ・4 min read

How to get the details of Instance using particular Elastic IP (EIP) - How to get the details of Instance using particular Elastic IP (EIP).

For example:
I have an EIP with me and I don't know where its located ?

Answering to - "I don't know where its located" :

  • You can use "nslookup" or "dig -x" command to check the "aws region" where EIP is located.


# dig -x +short
C:\Users\administrator> nslookup
Server:  recycled-xxxxxxxxxx.xxxx
Address:  xx.xx.xx.xx
Name:    ec2-52-37-109-242.us-west-2.compute.amazonaws.com

This confirms the association of domain with EIP and region of the resource is


Now, Let's figure out where or to which instance it has been attached to ??
The only way to get the details of EIP address associated with your Instance in a particular account is to login in the existing account and check it and you have two methods to do so:

1). Using console:-

  • Go to EC2 - Navigate to "Elastic IP" section on left or click here
  • Then you can see the EIP details and associations with an Instance. For more details , please check :

[+] https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html
[+] https://aws.amazon.com/premiumsupport/knowledge-center/vpc-find-owner-unknown-ip-addresses/

2). Using AWS CLI:-
You can use CLI command with API's (describe-addresses & describe-instances) to get the details of an EIP and its associations. I'm providing you an example below which you can refer.

Note : Please make sure you replace the EIP & Region details according to your resources where they are located in.

I've tested this as follows:

➜ Using (describe-addresses) you can get the info : ( AWS CLI command below)

# aws ec2 describe-addresses --public-ips YourEIPAddressHere --region us-west-2 --query "Addresses[].[PublicIp,PrivateIpAddress,InstanceId,AllocationId,AssociationId]" --output table


# aws ec2 describe-addresses --public-ips --region us-west-2 --query "Addresses[].[PublicIp,PrivateIpAddress,InstanceId,AllocationId,AssociationId]" --output table
|                                                  DescribeAddresses                                                 |
+---------------+---------------+----------------------+------------------------------+------------------------------+|  172.xx.xx.xx |  i-0axxxxxxxxxxxeipalloc-0fxxxxxxxxx  |  eipassoc-08xxxxxxxx  |

➜ Using (describe-instances) you can get the info : (AWS CLI command below)

# aws ec2 describe-instances --region us-west-2 --filter Name="ip-address",Values="YourEIPAddressHere" |grep 'InstanceId\| YourEIPAddressHere'


# aws ec2 describe-instances --region us-west-2 --filter Name="ip-address",Values="" |grep 'InstanceId|'
                    "InstanceId": "i-0axxxxxxxxxxx",
                    "PublicDnsName": "ec2-52-37-109-242.us-west-2.compute.amazonaws.com",
                    "PublicIpAddress": "",
                                "PublicDnsName": "ec2-52-37-109-242.us-west-2.compute.amazonaws.com",
                                "PublicIp": ""
                                        "PublicDnsName": "ec2-52-37-109-242.us-west-2.compute.amazonaws.com",
                                        "PublicIp": ""

To know more on filters , you can refer to our CLI reference guide on these APIs.

[+] describe-instances :- https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-instances.html

[+] describe-addresses :- https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-addresses.html

Dinesh Rathee

Posted on by:

dineshrathee12 profile

Dinesh Rathee


Dinesh Rathee , Young IT Professional 💻 Working in Dublin (Ireland) 💚 Enthusiast, Innovative, Loves Travelling 🛣 & Exploring ⛰🚵‍♂ #Fan of @elonmusk 🚀🛰, Proud Son👨‍🎓with Big Dreams.🏁


markdown guide