LaunchTemplateProps Struct
Properties of a LaunchTemplate.
Example
declare const instanceType: ec2.InstanceType;
const pg = new ec2.PlacementGroup(this, 'test-pg', {
strategy: ec2.PlacementGroupStrategy.SPREAD,
});
new ec2.LaunchTemplate(this, 'LaunchTemplate', {
instanceType,
machineImage: ec2.MachineImage.latestAmazonLinux2023(),
placementGroup: pg,
});
Properties
associatePublicIpAddressbooleanassociate_public_ip_addressboolassociatePublicIpAddressBooleanAssociatePublicIpAddressboolAssociatePublicIpAddress*bool= Use subnet settings#blockDevicesBlockDevice[]block_devicestyping.List[BlockDevice]blockDevicesList<BlockDevice>BlockDevicesBlockDevice[]BlockDevices*[]BlockDevice= Uses the block device mapping of…#notes · default
Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched.
Default: Uses the block device mapping of the AMI
cpuCreditsCpuCreditscpu_creditsCpuCreditscpuCreditsCpuCreditsCpuCreditsCpuCreditsCpuCreditsCpuCredits= No credit type is specified in t…#default
Default: No credit type is specified in the Launch Template.
cpuOptionsLaunchTemplateCpuOptionscpu_optionsLaunchTemplateCpuOptionscpuOptionsLaunchTemplateCpuOptionsCpuOptionsLaunchTemplateCpuOptionsCpuOptionsLaunchTemplateCpuOptions= The CPU options are not specifie…#default
Default: The CPU options are not specified in the launch template.
detailedMonitoringbooleandetailed_monitoringbooldetailedMonitoringBooleanDetailedMonitoringboolDetailedMonitoring*bool= False - Detailed monitoring is d…#default
Default: False - Detailed monitoring is disabled.
disableApiTerminationbooleandisable_api_terminationbooldisableApiTerminationBooleanDisableApiTerminationboolDisableApiTermination*bool= The API termination setting is n…#otherwise, you can.
default
Default: The API termination setting is not specified in the Launch Template.
ebsOptimizedbooleanebs_optimizedboolebsOptimizedBooleanEbsOptimizedboolEbsOptimized*bool= EBS optimization is not specifie…#notes · default
This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance.
Default: EBS optimization is not specified in the launch template.
hibernationConfiguredbooleanhibernation_configuredboolhibernationConfiguredBooleanHibernationConfiguredboolHibernationConfigured*bool= Hibernation configuration is not…#default
Default: Hibernation configuration is not specified in the launch template; defaulting to false.
httpProtocolIpv6booleanhttp_protocol_ipv6boolhttpProtocolIpv6BooleanHttpProtocolIpv6boolHttpProtocolIpv6*bool= true#httpPutResponseHopLimitnumberhttp_put_response_hop_limitint | floathttpPutResponseHopLimitNumberHttpPutResponseHopLimitdoubleHttpPutResponseHopLimit*float64= 1#The larger the number, the further instance metadata requests can travel.
httpTokensLaunchTemplateHttpTokenshttp_tokensLaunchTemplateHttpTokenshttpTokensLaunchTemplateHttpTokensHttpTokensLaunchTemplateHttpTokensHttpTokensLaunchTemplateHttpTokens= LaunchTemplateHttpTokens.OPTIONA…#The default state is optional if not specified. However, if requireImdsv2 is true, the state must be required.
default
Default: LaunchTemplateHttpTokens.OPTIONAL
instanceInitiatedShutdownBehaviorInstanceInitiatedShutdownBehaviorinstance_initiated_shutdown_behaviorInstanceInitiatedShutdownBehaviorinstanceInitiatedShutdownBehaviorInstanceInitiatedShutdownBehaviorInstanceInitiatedShutdownBehaviorInstanceInitiatedShutdownBehaviorInstanceInitiatedShutdownBehaviorInstanceInitiatedShutdownBehavior= Shutdown behavior is not specifi…#default
Default: Shutdown behavior is not specified in the launch template; defaults to STOP.
instanceMetadataTagsbooleaninstance_metadata_tagsboolinstanceMetadataTagsBooleanInstanceMetadataTagsboolInstanceMetadataTags*bool= false#Set to disabled to turn off access to instance tags from the instance metadata.
instanceProfileIInstanceProfileinstance_profileIInstanceProfileinstanceProfileIInstanceProfileInstanceProfileIInstanceProfileInstanceProfileIInstanceProfile= No instance profile#Note: You can provide an instanceProfile or a role, but not both.
instanceTypeInstanceTypeinstance_typeInstanceTypeinstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceTypeInstanceType= This Launch Template does not sp…#default
Default: This Launch Template does not specify a default Instance Type.
keyNamestringkey_namestrkeyNameStringKeyNamestringKeyName*string= No SSH access will be possible.deprecated#keyPairIKeyPairkey_pairIKeyPairkeyPairIKeyPairKeyPairIKeyPairKeyPairIKeyPair= No SSH access will be possible.#launchTemplateNamestringlaunch_template_namestrlaunchTemplateNameStringLaunchTemplateNamestringLaunchTemplateName*string= Automatically generated name#machineImageIMachineImagemachine_imageIMachineImagemachineImageIMachineImageMachineImageIMachineImageMachineImageIMachineImage= This Launch Template does not sp…#default
Default: This Launch Template does not specify a default AMI.
nitroEnclaveEnabledbooleannitro_enclave_enabledboolnitroEnclaveEnabledBooleanNitroEnclaveEnabledboolNitroEnclaveEnabled*bool= Enablement of Nitro enclaves is …#otherwise, it is not enabled for AWS Nitro Enclaves.
default
Default: Enablement of Nitro enclaves is not specified in the launch template; defaulting to false.
placementGroupIPlacementGroupRefplacement_groupIPlacementGroupRefplacementGroupIPlacementGroupRefPlacementGroupIPlacementGroupRefPlacementGroupIPlacementGroupRef= no placement group will be used …#default
Default: no placement group will be used for this launch template.
requireImdsv2booleanrequire_imdsv2boolrequireImdsv2BooleanRequireImdsv2boolRequireImdsv2*bool= false#The role must be assumable by the service principal ec2.amazonaws.com. Note: You can provide an instanceProfile or a role, but not both.
example
const role = new iam.Role(this, 'MyRole', {
assumedBy: new iam.ServicePrincipal('ec2.amazonaws.com')
});
securityGroupISecurityGroupsecurity_groupISecurityGroupsecurityGroupISecurityGroupSecurityGroupISecurityGroupSecurityGroupISecurityGroup= No security group is assigned.#spotOptionsLaunchTemplateSpotOptionsspot_optionsLaunchTemplateSpotOptionsspotOptionsLaunchTemplateSpotOptionsSpotOptionsLaunchTemplateSpotOptionsSpotOptionsLaunchTemplateSpotOptions= Instance launched with this temp…#default
Default: Instance launched with this template will not be spot instances.
userDataUserDatauser_dataUserDatauserDataUserDataUserDataUserDataUserDataUserData= This Launch Template creates a U…#default
Default: This Launch Template creates a UserData based on the type of provided machineImage; no UserData is created if a machineImage is not provided
versionDescriptionstringversion_descriptionstrversionDescriptionStringVersionDescriptionstringVersionDescription*string= No description#The version description must be maximum 255 characters long.