create_launch_template
async
¶
create_launch_template(
*,
config_overrides: Optional[AsyncEC2ClientConfig] = None,
dry_run: Optional[Boolean] = None,
client_token: Optional[String] = None,
launch_template_name: Optional[String] = None,
version_description: Optional[VersionDescription] = None,
launch_template_data: Optional[RequestLaunchTemplateData] = None,
operator: Optional[OperatorRequest] = None,
tag_specifications: Optional[TagSpecificationList] = None,
) -> CreateLaunchTemplateResult
Creates a launch template.
A launch template contains the parameters to launch an instance. When you launch an instance using RunInstances, you can specify a launch template instead of providing the launch parameters in the request. For more information, see Store instance launch parameters in Amazon EC2 launch templates in the Amazon EC2 User Guide.
To clone an existing launch template as the basis for a new launch template, use the Amazon EC2 console. The API, SDKs, and CLI do not support cloning a template. For more information, see Create a launch template from an existing launch template in the Amazon EC2 User Guide.
Parameters:
-
dry_run(Optional[Boolean], default:None) –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. -
client_token(Optional[String], default:None) –Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If a client token isn't specified, a randomly generated token is used in the request to ensure idempotency.
For more information, see Ensuring idempotency.
Constraint: Maximum 128 ASCII characters.
-
launch_template_name(Optional[String], default:None) –A name for the launch template.
-
version_description(Optional[VersionDescription], default:None) –A description for the first version of the launch template.
-
launch_template_data(Optional[RequestLaunchTemplateData], default:None) –The information for the launch template.
-
operator(Optional[OperatorRequest], default:None) –Reserved for internal use.
-
tag_specifications(Optional[TagSpecificationList], default:None) –The tags to apply to the launch template on creation. To tag the launch template, the resource type must be
launch-template.To specify the tags for the resources that are created when an instance is launched, you must use the
TagSpecificationsparameter in the launch template data structure.
Raises:
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
To create a launch template This example creates a launch template that specifies the subnet in which to launch the instance, assigns a public IP address and an IPv6 address to the instance, and creates a tag for the instance.
>>> await client.create_launch_template(launch_template_name='my-template', version_description='WebVersion1', launch_template_data={'NetworkInterfaces': [{'AssociatePublicIpAddress': True, 'DeviceIndex': 0, 'Ipv6AddressCount': 1, 'SubnetId': 'subnet-7b16de0c'}], 'ImageId': 'ami-8c1be5f6', 'InstanceType': 't2.small', 'TagSpecifications': [{'ResourceType': 'instance', 'Tags': [{'Key': 'Name', 'Value': 'webserver'}]}]})
Source code in docs_src/capo_ec2/_services/async_ec2.py
10018 10019 10020 10021 10022 10023 10024 10025 10026 10027 10028 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 10044 10045 10046 10047 10048 10049 10050 10051 10052 10053 10054 10055 10056 10057 10058 10059 10060 10061 10062 10063 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 10105 10106 10107 10108 | |