Retrieving the IP address of an EC2 instance given an instance ID

Question:

Using the aws CLI, how can I retrieve the private IP address of an EC2 instance given its instanceID?

When I do:

I get other information, but not the private IP addresses such as:

Answer:

Try describe-instances instead. Private IP Address isn’t returned with describe-instance-status because that command describes system and instance status, primarily concerning itself with hardware/issues or scheduled events.

Per the “Output” section of the describe-instances documentation, part of the output of describe-instances is a string PrivateIpAddress.

Example usage:

Leave a Reply