Skip to content

EC2  >  Operations  >  create_launch_template

create_launch_template

Operation

create_launch_template async

create_launch_template(input: CreateLaunchTemplateInput, plugins: list[Plugin] | None = None) -> CreateLaunchTemplateOutput

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:

Name Type Description Default
input CreateLaunchTemplateInput

An instance of CreateLaunchTemplateInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
CreateLaunchTemplateOutput

An instance of CreateLaunchTemplateOutput.

Input

CreateLaunchTemplateInput dataclass

Bases: _SerdeShape

Dataclass for CreateLaunchTemplateInput structure.

Attributes

client_token class-attribute instance-attribute
client_token: str | 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.

dry_run class-attribute instance-attribute
dry_run: bool | 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 is UnauthorizedOperation.

launch_template_data class-attribute instance-attribute
launch_template_data: RequestLaunchTemplateData | None = ...

The information for the launch template.

launch_template_name class-attribute instance-attribute
launch_template_name: str | None = ...

A name for the launch template.

operator class-attribute instance-attribute
operator: OperatorRequest | None = ...

Reserved for internal use.

tag_specifications class-attribute instance-attribute
tag_specifications: list[TagSpecification] | 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 TagSpecifications parameter in the launch template data structure.

version_description class-attribute instance-attribute
version_description: str | None = ...

A description for the first version of the launch template.

Output

CreateLaunchTemplateOutput dataclass

Bases: _SerdeShape

Dataclass for CreateLaunchTemplateOutput structure.

Attributes

launch_template class-attribute instance-attribute
launch_template: LaunchTemplate | None = ...

Information about the launch template.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.

warning class-attribute instance-attribute
warning: ValidationWarning | None = ...

If the launch template contains parameters or parameter combinations that are not valid, an error code and an error message are returned for each issue that's found.