Get AWS Instance Info with ec2-metadata
AWS
If you are just starting with AWS, you may not know that Amazon Linux images have a special command for confirming most useful information about EC2 instance: ec2-metadata.
Instance info with ec2-metadata
If you just run the command without options, you’ll get to see all the available meta info.
Here’s an example from the vps2.unixtutorial.org instance (give me a shout if you want access to it for learning Linux!):
Command line options for ec2-metadata
There are also lots of command line options to show individual fields from this output.
Confirm AMI image ID with ec2-metadata
Confirm Current EC2 Instance ID with ec2-metadata
Confirm Internal IP addresses with ec2-metadata
Confirm external IP address with ec2-metadata
This will only work if you actually have external IPv4 address mapped to your instance.
Are you interested in more AWS related posts and Unix tutorials? Please let me know!
See Also
AWS
If you are just starting with AWS, you may not know that Amazon Linux images have a special command for confirming most useful information about EC2 instance: ec2-metadata.
Instance info with ec2-metadata
If you just run the command without options, you’ll get to see all the available meta info.
Here’s an example from the vps2.unixtutorial.org instance (give me a shout if you want access to it for learning Linux!):
Command line options for ec2-metadata
There are also lots of command line options to show individual fields from this output.
Confirm AMI image ID with ec2-metadata
Confirm Current EC2 Instance ID with ec2-metadata
Confirm Internal IP addresses with ec2-metadata
Confirm external IP address with ec2-metadata
This will only work if you actually have external IPv4 address mapped to your instance.
Are you interested in more AWS related posts and Unix tutorials? Please let me know!