Each virtual machine has its own set of information that can be accessed via the HTTP protocol using GET requests. The interface is available at the address: https://169.254.169.254/latest/meta-data
from within the virtual machine.
Command
curl https://169.254.169.254/latest/meta-data/public-ipv4
Result
178.216.200.XXX
Information about the machine can be obtained with the ec2-metadata
command:
# ec2-metadata --all
ami-id: ami-000006d8
ami-launch-index: 0
ami-manifest-path: not available
ancestor-ami-ids: not available
block-device-mapping: not available
instance-id: XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
instance-type: c1.m1024
local-hostname: ip-178-216-200-XXX.e24cloud.com
local-ipv4: 178.216.200.XXX 178.216.201.XXX
kernel-id: not available
placement: eu-poland-1
product-codes: not available
public-hostname: ip-178-216-200-XXX.e24cloud.com
public-ipv4: 178.216.200.XXX 178.216.201.XXX
public-keys:
ramdisk-id: not available
reservation-id: not available
security-groups:
user-data: