You have an EC2 instance which needs to find out both its private IP address and its public IP address. To do
this you need to;
A.
Run IPCONFIG (Windows) or IFCONFIG (Linux)
B.
Retrieve the instance Metadata from http://169.254.169.254/latest/meta-data/
C.
Retrieve the instance Userdata from http://169.254.169.254/latest/meta-data/
D.
Use the following command; AWS EC2 displayIP