EC2.Client.
modify_launch_template
(**kwargs)¶Modifies a launch template. You can specify which version of the launch template to set as the default version. When launching an instance, the default version applies when a launch template version is not specified.
See also: AWS API Documentation
Request Syntax
response = client.modify_launch_template(
DryRun=True|False,
ClientToken='string',
LaunchTemplateId='string',
LaunchTemplateName='string',
DefaultVersion='string'
)
DryRunOperation
. Otherwise, it is UnauthorizedOperation
.Unique, case-sensitive identifier you provide to ensure the idempotency of the request. For more information, see Ensuring idempotency.
Constraint: Maximum 128 ASCII characters.
The ID of the launch template.
You must specify either the LaunchTemplateId
or the LaunchTemplateName
, but not both.
The name of the launch template.
You must specify either the LaunchTemplateName
or the LaunchTemplateId
, but not both.
dict
Response Syntax
{
'LaunchTemplate': {
'LaunchTemplateId': 'string',
'LaunchTemplateName': 'string',
'CreateTime': datetime(2015, 1, 1),
'CreatedBy': 'string',
'DefaultVersionNumber': 123,
'LatestVersionNumber': 123,
'Tags': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
Response Structure
(dict) --
LaunchTemplate (dict) --
Information about the launch template.
LaunchTemplateId (string) --
The ID of the launch template.
LaunchTemplateName (string) --
The name of the launch template.
CreateTime (datetime) --
The time launch template was created.
CreatedBy (string) --
The principal that created the launch template.
DefaultVersionNumber (integer) --
The version number of the default version of the launch template.
LatestVersionNumber (integer) --
The version number of the latest version of the launch template.
Tags (list) --
The tags for the launch template.
(dict) --
Describes a tag.
Key (string) --
The key of the tag.
Constraints: Tag keys are case-sensitive and accept a maximum of 127 Unicode characters. May not begin with aws:
.
Value (string) --
The value of the tag.
Constraints: Tag values are case-sensitive and accept a maximum of 256 Unicode characters.
Examples
This example specifies version 2 as the default version of the specified launch template.
response = client.modify_launch_template(
DefaultVersion='2',
LaunchTemplateId='lt-0abcd290751193123',
)
print(response)
Expected Output:
{
'LaunchTemplate': {
'CreateTime': datetime(2017, 12, 1, 13, 35, 46, 4, 335, 0),
'CreatedBy': 'arn:aws:iam::123456789012:root',
'DefaultVersionNumber': 2,
'LatestVersionNumber': 2,
'LaunchTemplateId': 'lt-0abcd290751193123',
'LaunchTemplateName': 'WebServers',
},
'ResponseMetadata': {
'...': '...',
},
}