Get EC2 instance Information Ubuntu

ec2metadata --instance -h

E.g. To get the ID:

ec2metadata --instance-id