Amazon Elastic Compute Cloud
User Guide for Linux Instances

Identify EC2 Instances

You may benefit from a simple method to determine whether a system is an EC2 instance to determine if other resources like the Instance Metadata Service should be used to configure or verify the EC2 identity of the system. This topic describes two approaches to identifying an EC2 instance, one of them quick but potentially inaccurate, and the other more involved but also definitive.

Inspecting the System UUID

The methods described in this section determine optimistically whether a system is an EC2 instance by examining the system UUID. This approach looks for the presence of the characters "ec2" or "EC2" in the beginning octet of the UUID.


There is a small chance that a system that is not an EC2 instance could also include these characters.

You can discover the system UUID using the approaches below. To handle all types of EC2 instances, both approaches must be used. For information about identifying Windows instances, see

  • On a Linux system, run the following command:

    [ec2-user ~]$ cat /sys/hypervisor/uuid

    This returns a UUID:


    In this example, the prepended "ec2" indicates that the system is probably an EC2 instance. If /sys/hypervisor/uuid does not exist, continue to the second approach of obtaining the system UUID from the Desktop Management Interface (DMI) table.

  • Additionally, on HVM instances only, the Desktop Management Interface (DMI) contains the system UUID. One of the following commands should return it:

    [ec2-user ~]$ sudo dmidecode --string system-uuid


    [ec2-user ~]$ sudo cat /sys/devices/virtual/dmi/id/product_uui



Inspecting the Instance Identity Document

For a definitive and cryptographically verified method of identifying an EC2 instance, check the instance identity document, including its signature. These documents are available on every EC2 instance at the local, non-routable address For more information, see Instance Identity Documents.