Understanding AWS EC2 Instance Metadata

Understanding AWS EC2 Instance Metadata

AWS EC2 is a scalable, reliable and low-priced offering from Amazon for the user’s virtual computation or hosting needs. An Amazon Machine Image (AMI) is an encrypted packaged-up environment that includes all the necessary bits to set up and boot the user’s instance. After an AMI is launched, the resultant running system is called an instance. Learn how to Launch an Amazon AWS EC2 Instance. The instance is the user’s basic computation building block. Amazon EC2 offers multiple instance types based on the RAM, Storage and Compute Units. Once launched, an instance looks very similar to a traditional host. The user will have complete control on the instances.

The present guide helps to understand the various parameters of metadata of an AWS Instance. Learn how to get the EC2 metadata.

1. Go to the AWS Console and enter the EC2 service.

2. The EC2 dashboard displays information, such as the currently running instance, the available Elastic IPs, the EBS Volumes and Snapshots, Elastic Load balancer (ELB), Key pairs and information about the security groups. It also displays the current region and the health of the AWS service in that region. Select “Instances” to see more details about an AWS instance.

[Newvem analytics provides comprehensive visibility to your EC2 footprint with drill downs from a consolidated view to a detailed resource status report. Newvem continuously analyzes EC2 instance utilization patterns and provides a down-to-the-hour picture of your AWS EC2 consumption and usage. Learn more about Newvem's features]

3. The Instances dashboard displays all the instances of that region. The AWS Console provides an option to filter instances based on the state (running, stopped). Select any running instance. The metadata of that instance will be displayed, as shown below.

4. Select the “Description” tab of the console.  It first lists the public DNS or Elastic IP (if assigned) of the instance. The following information will be displayed:

a. AMI : AMI Used to launch the instance
b. Zone : Availability zone where the instance is running
c. Type : Instance type, such as micro, medium, small, large, etc
d. Security Group : Virtual firewall created for the instance using the Security group
e. State : Instance state (Running / Stopped / Pending / Terminated)
f. Owner : AWS Account ID of the instance owner
g. Platform : Windows or RHEL, etc
h. VPC ID: If the instance was launched under VPC then the ID of  VPC
i. Placement Group: Cluster where this instance belongs (For Cluster compute Instance)
j. Virtualization : Type of virtual machine
k. Alarm Status: The status of the CloudWatch alarm, if configured
l. RAM Disk ID: RAM Disk associated with the Instance

5. Scroll down the description and there are many other fields associated with the instance, such as:

a. Key-Pair Name :The key pair used while launching the instance
b. Monitoring : Basic or detailed Cloudwatch monitoring
c. Elastic IP : The elastic IP address, if assigned to the instance
d. Root Device Type: Choose between EBS based or Instance-store based root device.
e. IAM Role : If any IAM role used while launching the instance
f. EBS Optimized: Whether the instance is EBS optimized.
g. Block Devices : EBS Volumes attached with the instance
h. Public DNS : The public host name of the instance used for public internet communication
i. Private DNS : The private host name of the instance used for inter region communication
j. Private IPs: Private IP of the instance
k. Launch Time: Date and time when the instance was launched
l. Kernel ID: OS Kernel associated with the AMI.
m. AMI Launch Index: The order in which the instance was launched
n. Root Device: System device name that contains the boot volume
o. Lifecycle: Normal / Spot
p. Termination Protection: If enabled, the user will not be able to terminate the instance through CLI.

6. Click on the “Status Checks” tab. Status checks detect the problem which may stop the user from accessing the instance or running the application. There are two major status checks: 1) AWS System reachability  2) Instance reachability

7. Click on the “Monitoring” tab, which displays the alarms as well as the Cloudwatch metrics. Click on the “Enable Detailed Monitoring” tab to enable detailed Cloudwatch monitoring. Click on the “Create Alarm” tab to set the CloudWatch alarm for any metric.

8. Click on “Tags” to configure the tags of an instance.  Tagging is very useful when the user wants to track the cost of a particular instance / service.

9. The EC2 console allows for various operations on an instance. Click on the “Action” menu, which displays the following options:

a. Connect to an instance using SSH
b. Get the log of an instance
c. Create an Image (if EBS backed Instance)
d. Add / Edit Tags. The tags are useful, as explained in How to track costs of S3 cloud objects
e. Enable or disable termination protection
f. Configure user data used during the Instance boot time
g. Reboot / Stop / Terminate / Start an EC2 Instance
h. Enable detailed monitoring
i. Add / Edit Cloudwatch alarms
j. Change the Instance type
k. Change the security group (Applicable for VPC only)
l. Get the Windows Admin password

Get the EC2 Instance Using the AWS CLI Tools

10. To run the above mentioned steps through the command line interface, first setup AWS EC2 CLI to launch an instance with the command line option, as explained here.

11. To list all the instances of that region, run the command:

ec2-describe-instance --region us-west-2

12. The actual output is shown below:

[Newvem analytics tracks your AWS cloud utilization:

Get started with Newvem for free or learn more about Newvem's features]

Keywords: Amazon AWS elastic cloud services, Amazon EC2, Cloud Utilization, Amazon Web Services, AWS EC2, Amazon Machine Image, AWS AMI, Elastic IP, EBS Volumes, EC2 instance metadata, VPC, Ec2 Monitoring, Elastic IP, CloudWatch

You must be to post a comment.

* As a bonus, you'll receive our weekly newsletter!

Hitchhiker's Guide to The Cloud

Newvem's eBook for Cloud Operations