AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Namespace: Amazon.EC2.Util
Assembly: AWSSDK.dll
Version: (assembly version)
public static class EC2Metadata : Object
The EC2Metadata type exposes the following members
Name | Type | Description | |
---|---|---|---|
AmiId | System.String | The AMI ID used to launch the instance. | |
AmiLaunchIndex | System.String | The index of this instance in the reservation. | |
AmiManifestPath | System.String | The manifest path of the AMI with which the instance was launched. | |
AncestorAmiIds | System.Collections.Generic.IEnumerable<System.String> | The AMI IDs of any instances that were rebundled to create this AMI. Will only exist if the AMI manifest file contained an ancestor-amis key. | |
AvailabilityZone | System.String | The Availability Zone in which the instance launched. | |
BlockDeviceMapping | System.Collections.Generic.IDictionary<System.String, System.String> | The virtual devices associated with the ami, root, ebs, and swap. | |
Hostname | System.String | The private hostname of the instance. In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which the device number is 0). | |
IAMInstanceProfileInfo | Amazon.EC2.Util.IAMInfo | Returns information about the last time the instance profile was updated, including the instance's LastUpdated date, InstanceProfileArn, and InstanceProfileId. | |
IAMSecurityCredentials | System.Collections.Generic.IDictionary<System.String, Amazon.EC2.Util.IAMSecurityCredential> | Returns the temporary security credentials (AccessKeyId, SecretAccessKey, SessionToken, and Expiration) associated with the IAM roles on the instance. | |
InstanceAction | System.String | Notifies the instance that it should reboot in preparation for bundling. Valid values: none | shutdown | bundle-pending. | |
InstanceId | System.String | The ID of this instance. | |
InstanceType | System.String | The type of instance. | |
KernelId | System.String | The ID of the kernel launched with this instance, if applicable. | |
LocalHostname | System.String | The local hostname of the instance. In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which device-number is 0). | |
MacAddress | System.String | The instance's MAC address. In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which device-number is 0). | |
NetworkInterfaces | System.Collections.Generic.IEnumerable<Amazon.EC2.Util.NetworkInterface> | The network interfaces on the instance. | |
PrivateIpAddress | System.String | The private IP address of the instance. In cases where multiple network interfaces are present, this refers to the eth0 device (the device for which device-number is 0). | |
ProductCodes | System.Collections.Generic.IEnumerable<System.String> | Product codes associated with the instance, if any. | |
PublicKey | System.String | Public key. Only available if supplied at instance launch time. | |
RamdiskId | System.String | The ID of the RAM disk specified at launch time, if applicable. | |
ReservationId | System.String | ID of the reservation. | |
SecurityGroups | System.Collections.Generic.IEnumerable<System.String> | The names of the security groups applied to the instance. | |
UserData | System.String | The metadata sent to the instance. |
Name | Description | |
---|---|---|
GetData(string) | Return the metadata at the path | |
GetData(string, int) | Return the metadata at the path | |
GetItems(string) | Return the list of items in the metadata at path. | |
GetItems(string, int) | Return the list of items in the metadata at path. |
Amazon EC2 instances can access instance-specific metadata, as well as data supplied when launching the instances, using a specific URI.
You can use this data to build more generic AMIs that can be modified by configuration files supplied at launch time. For example, if you run web servers for various small businesses, they can all use the same AMI and retrieve their content from the Amazon S3 bucket you specify at launch. To add a new customer at any time, simply create a bucket for the customer, add their content, and launch your AMI.
More information about EC2 Metadata http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AESDG-chapter-instancedata.html
.NET Framework:
Supported in: 4.5, 4.0, 3.5