How to Query AWS EC2 Instance Metadata

In this tutorial we will learn how to get EC2 Instance Metadata from an AWS EC2 instance. We will get the metadata using ec2-metadata and ec2 metadata. This is not typo. The tools’ names are really similar but one of them uses dash on its name.