launch_templates
Creates, updates, deletes or gets a launch_template resource or lists launch_templates in a region
Overview
| Name | launch_templates |
| Type | Resource |
| Description | Specifies the properties for creating a launch template. The minimum required properties for specifying a launch template are as follows: + You must specify at least one property for the launch template data. + You can optionally specify a name for the launch template. If you do not specify a name, CFN creates a name for you. A launch template can contain some or all of the configuration information to launch an instance. When you launch an instance using a launch template, instance properties that are not specified in the launch template use default values, except the ``ImageId`` property, which has no default value. If you do not specify an AMI ID for the launch template ``ImageId`` property, you must specify an AMI ID for the instance ``ImageId`` property. For more information, see [Launch an instance from a launch template](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-launch-templates.html) in the *Amazon EC2 User Guide*. |
| Id | awscc.ec2.launch_templates |
Fields
| Name | Datatype | Description |
|---|---|---|
launch_template_name | string | A name for the launch template. |
launch_template_data | object | The information for the launch template. |
version_description | string | A description for the first version of the launch template. |
tag_specifications | array | The tags to apply to the launch template on creation. To tag the launch template, the resource type must be ``launch-template``.<br />To specify the tags for resources that are created during instance launch, use [TagSpecifications](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-launchtemplate-launchtemplatedata.html#cfn-ec2-launchtemplate-launchtemplatedata-tagspecifications). |
latest_version_number | string | |
launch_template_id | string | |
default_version_number | string | |
region | string | AWS region. |
For more information, see AWS::EC2::LaunchTemplate.
Methods
| Name | Accessible by | Required Params |
|---|---|---|
create_resource | INSERT | LaunchTemplateData, region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT examples
Gets all properties from an individual launch_template.
SELECT
region,
launch_template_name,
launch_template_data,
version_description,
tag_specifications,
latest_version_number,
launch_template_id,
default_version_number
FROM awscc.ec2.launch_templates
WHERE region = 'us-east-1' AND data__Identifier = '<LaunchTemplateId>';
INSERT example
Use the following StackQL query and manifest file to create a new launch_template resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.ec2.launch_templates (
LaunchTemplateData,
region
)
SELECT
'{{ LaunchTemplateData }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.ec2.launch_templates (
LaunchTemplateName,
LaunchTemplateData,
VersionDescription,
TagSpecifications,
region
)
SELECT
'{{ LaunchTemplateName }}',
'{{ LaunchTemplateData }}',
'{{ VersionDescription }}',
'{{ TagSpecifications }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: launch_template
props:
- name: LaunchTemplateName
value: '{{ LaunchTemplateName }}'
- name: LaunchTemplateData
value:
SecurityGroups:
- '{{ SecurityGroups[0] }}'
TagSpecifications:
- ResourceType: '{{ ResourceType }}'
Tags:
- Key: '{{ Key }}'
Value: '{{ Value }}'
NetworkPerformanceOptions:
BandwidthWeighting: '{{ BandwidthWeighting }}'
UserData: '{{ UserData }}'
BlockDeviceMappings:
- DeviceName: '{{ DeviceName }}'
Ebs:
DeleteOnTermination: '{{ DeleteOnTermination }}'
Encrypted: '{{ Encrypted }}'
Iops: '{{ Iops }}'
SnapshotId: '{{ SnapshotId }}'
VolumeSize: '{{ VolumeSize }}'
VolumeType: '{{ VolumeType }}'
NoDevice: '{{ NoDevice }}'
VirtualName: '{{ VirtualName }}'
MaintenanceOptions:
AutoRecovery: '{{ AutoRecovery }}'
IamInstanceProfile:
Arn: '{{ Arn }}'
Name: '{{ Name }}'
KernelId: '{{ KernelId }}'
EbsOptimized: '{{ EbsOptimized }}'
Placement:
GroupName: '{{ GroupName }}'
Tenancy: '{{ Tenancy }}'
SpreadDomain: '{{ SpreadDomain }}'
PartitionNumber: '{{ PartitionNumber }}'
AvailabilityZone: '{{ AvailabilityZone }}'
Affinity: '{{ Affinity }}'
HostId: '{{ HostId }}'
HostResourceGroupArn: '{{ HostResourceGroupArn }}'
GroupId: '{{ GroupId }}'
NetworkInterfaces:
- Description: '{{ Description }}'
PrivateIpAddress: '{{ PrivateIpAddress }}'
PrivateIpAddresses:
- Primary: '{{ Primary }}'
PrivateIpAddress: '{{ PrivateIpAddress }}'
SecondaryPrivateIpAddressCount: '{{ SecondaryPrivateIpAddressCount }}'
Ipv6PrefixCount: '{{ Ipv6PrefixCount }}'
Ipv4Prefixes:
- Ipv4Prefix: '{{ Ipv4Prefix }}'
Ipv4PrefixCount: '{{ Ipv4PrefixCount }}'
EnablePrimaryIpv6: '{{ EnablePrimaryIpv6 }}'
GroupSet:
- '{{ GroupSet[0] }}'
Ipv6Addresses:
- Ipv6Address: '{{ Ipv6Address }}'
Ipv6Prefixes:
- Ipv6Prefix: '{{ Ipv6Prefix }}'
SubnetId: '{{ SubnetId }}'
SourceDestCheck: '{{ SourceDestCheck }}'
InterfaceType: '{{ InterfaceType }}'
Ipv6AddressCount: '{{ Ipv6AddressCount }}'
Tags:
- null
ConnectionTrackingSpecification:
UdpTimeout: '{{ UdpTimeout }}'
TcpEstablishedTimeout: '{{ TcpEstablishedTimeout }}'
UdpStreamTimeout: '{{ UdpStreamTimeout }}'
EnclaveOptions:
Enabled: '{{ Enabled }}'
ImageId: '{{ ImageId }}'
InstanceType: '{{ InstanceType }}'
Monitoring:
Enabled: '{{ Enabled }}'
HibernationOptions:
Configured: '{{ Configured }}'
MetadataOptions:
HttpPutResponseHopLimit: '{{ HttpPutResponseHopLimit }}'
HttpTokens: '{{ HttpTokens }}'
HttpProtocolIpv6: '{{ HttpProtocolIpv6 }}'
InstanceMetadataTags: '{{ InstanceMetadataTags }}'
HttpEndpoint: '{{ HttpEndpoint }}'
LicenseSpecifications:
- LicenseConfigurationArn: '{{ LicenseConfigurationArn }}'
InstanceInitiatedShutdownBehavior: '{{ InstanceInitiatedShutdownBehavior }}'
DisableApiStop: '{{ DisableApiStop }}'
CpuOptions:
ThreadsPerCore: '{{ ThreadsPerCore }}'
AmdSevSnp: '{{ AmdSevSnp }}'
CoreCount: '{{ CoreCount }}'
PrivateDnsNameOptions:
EnableResourceNameDnsARecord: '{{ EnableResourceNameDnsARecord }}'
HostnameType: '{{ HostnameType }}'
EnableResourceNameDnsAAAARecord: '{{ EnableResourceNameDnsAAAARecord }}'
SecurityGroupIds:
- '{{ SecurityGroupIds[0] }}'
KeyName: '{{ KeyName }}'
DisableApiTermination: '{{ DisableApiTermination }}'
InstanceMarketOptions:
SpotOptions:
SpotInstanceType: '{{ SpotInstanceType }}'
InstanceInterruptionBehavior: '{{ InstanceInterruptionBehavior }}'
MaxPrice: '{{ MaxPrice }}'
BlockDurationMinutes: '{{ BlockDurationMinutes }}'
ValidUntil: '{{ ValidUntil }}'
MarketType: '{{ MarketType }}'
InstanceRequirements:
InstanceGenerations:
- '{{ InstanceGenerations[0] }}'
MemoryGiBPerVCpu:
Min: null
Max: null
AcceleratorTypes:
- '{{ AcceleratorTypes[0] }}'
VCpuCount:
Min: '{{ Min }}'
Max: '{{ Max }}'
AcceleratorManufacturers:
- '{{ AcceleratorManufacturers[0] }}'
LocalStorage: '{{ LocalStorage }}'
CpuManufacturers:
- '{{ CpuManufacturers[0] }}'
BareMetal: '{{ BareMetal }}'
RequireHibernateSupport: '{{ RequireHibernateSupport }}'
MaxSpotPriceAsPercentageOfOptimalOnDemandPrice: '{{ MaxSpotPriceAsPercentageOfOptimalOnDemandPrice }}'
OnDemandMaxPricePercentageOverLowestPrice: '{{ OnDemandMaxPricePercentageOverLowestPrice }}'
MemoryMiB:
Min: '{{ Min }}'
Max: '{{ Max }}'
LocalStorageTypes:
- '{{ LocalStorageTypes[0] }}'
NetworkInterfaceCount:
Min: '{{ Min }}'
Max: '{{ Max }}'
ExcludedInstanceTypes:
- '{{ ExcludedInstanceTypes[0] }}'
AllowedInstanceTypes:
- '{{ AllowedInstanceTypes[0] }}'
AcceleratorCount:
Min: '{{ Min }}'
Max: '{{ Max }}'
NetworkBandwidthGbps:
Min: null
Max: null
BaselinePerformanceFactors:
Cpu:
References:
- InstanceFamily: '{{ InstanceFamily }}'
SpotMaxPricePercentageOverLowestPrice: '{{ SpotMaxPricePercentageOverLowestPrice }}'
BaselineEbsBandwidthMbps:
Min: '{{ Min }}'
Max: '{{ Max }}'
AcceleratorNames:
- '{{ AcceleratorNames[0] }}'
AcceleratorTotalMemoryMiB:
Min: '{{ Min }}'
Max: '{{ Max }}'
BurstablePerformance: '{{ BurstablePerformance }}'
TotalLocalStorageGB:
Min: null
Max: null
RamDiskId: '{{ RamDiskId }}'
CapacityReservationSpecification:
CapacityReservationPreference: '{{ CapacityReservationPreference }}'
CapacityReservationTarget:
CapacityReservationResourceGroupArn: '{{ CapacityReservationResourceGroupArn }}'
CapacityReservationId: '{{ CapacityReservationId }}'
CreditSpecification:
CpuCredits: '{{ CpuCredits }}'
- name: VersionDescription
value: '{{ VersionDescription }}'
- name: TagSpecifications
value:
- ResourceType: '{{ ResourceType }}'
Tags:
- null
DELETE example
/*+ delete */
DELETE FROM awscc.ec2.launch_templates
WHERE data__Identifier = '<LaunchTemplateId>'
AND region = 'us-east-1';
Permissions
To operate on the launch_templates resource, the following permissions are required:
Read
ec2:DescribeLaunchTemplates
Create
ec2:CreateLaunchTemplate,
ec2:CreateTags
Update
ec2:CreateLaunchTemplateVersion
List
ec2:DescribeLaunchTemplates
Delete
ec2:DeleteLaunchTemplate,
ec2:DeleteTags,
ec2:DescribeLaunchTemplates