GetLaunchTemplateData
Retrieves the configuration data of the specified instance. You can use this data to create a launch template.
This action calls on other describe actions to get instance information. Depending on
your instance configuration, you may need to allow the following actions in your IAM
policy: DescribeSpotInstanceRequests
, DescribeInstanceCreditSpecifications
,
DescribeVolumes
, and DescribeInstanceAttribute
. Or,
you can allow describe*
depending on your instance requirements.
Request Parameters
The following parameters are for this specific action. For more information about required and optional parameters that are common to all actions, see Common Query Parameters.
- DryRun
-
Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is
DryRunOperation
. Otherwise, it isUnauthorizedOperation
.Type: Boolean
Required: No
- InstanceId
-
The ID of the instance.
Type: String
Required: Yes
Response Elements
The following elements are returned by the service.
- launchTemplateData
-
The instance data.
Type: ResponseLaunchTemplateData object
- requestId
-
The ID of the request.
Type: String
Errors
For information about the errors that are common to all actions, see Common client error codes.
Examples
Example
This example gets the data for instance
i-123456abcabc123ab
.
Sample Request
https://ec2.amazonaws.com/?Action=GetLaunchTemplateData
&InstanceId=i-123456abcabc123ab
&AUTHPARAMS
Sample Response
<GetLaunchTemplateDataResponse xmlns="http://ec2.amazonaws.com/doc/2016-11-15/">
<requestId>57372b95-c320-409e-b268-1e4example</requestId>
<launchTemplateData>
<blockDeviceMappingSet>
<item>
<deviceName>/dev/xvda</deviceName>
<ebs>
<deleteOnTermination>true</deleteOnTermination>
</ebs>
</item>
</blockDeviceMappingSet>
<ebsOptimized>false</ebsOptimized>
<iamInstanceProfile>
<arn>arn:aws:iam::123456789012:instance-profile/AdminRole</arn>
</iamInstanceProfile>
<imageId>ami-1a2b3c4d</imageId>
<instanceType>t2.micro</instanceType>
<keyName>kp-us-east</keyName>
<monitoring/>
<networkInterfaceSet>
<item>
<description>Primary network interface</description>
<groupSet>
<groupId>sg-7c227abc</groupId>
</groupSet>
<ipv6AddressesSet/>
<networkInterfaceId>eni-d26c8f36</networkInterfaceId>
<privateIpAddress>10.0.0.197</privateIpAddress>
<privateIpAddressesSet>
<item>
<primary>true</primary>
<privateIpAddress>10.0.0.197</privateIpAddress>
</item>
</privateIpAddressesSet>
<subnetId>subnet-7b16dabc</subnetId>
</item>
<item>
<description>my network interface</description>
<groupSet>
<groupId>sg-54e8b123</groupId>
</groupSet>
<ipv6AddressesSet/>
<networkInterfaceId>eni-714bc4a5</networkInterfaceId>
<privateIpAddress>10.0.0.190</privateIpAddress>
<privateIpAddressesSet>
<item>
<primary>true</primary>
<privateIpAddress>10.0.0.190</privateIpAddress>
</item>
</privateIpAddressesSet>
<subnetId>subnet-7b16de0c</subnetId>
</item>
</networkInterfaceSet>
<placement>
<availabilityZone>us-east-1a</availabilityZone>
<groupName/>
<tenancy>default</tenancy>
</placement>
</launchTemplateData>
</GetLaunchTemplateDataResponse>
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: