Class CfnLaunchTemplatePropsMixin

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.Mixin
software.amazon.awscdk.cfnpropertymixins.services.ec2.CfnLaunchTemplatePropsMixin
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable, software.constructs.IMixin

@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)", date="2026-03-11T13:19:58.489Z") @Stability(Stable) public class CfnLaunchTemplatePropsMixin extends Mixin implements software.constructs.IMixin
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, CloudFormation 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 in the Amazon EC2 User Guide .

Example:

 // The code below shows an example of how to instantiate this type.
 // The values are placeholders you should change.
 import software.amazon.awscdk.cfnpropertymixins.services.ec2.*;
 import software.amazon.awscdk.*;
 IMergeStrategy mergeStrategy;
 CfnLaunchTemplatePropsMixin cfnLaunchTemplatePropsMixin = CfnLaunchTemplatePropsMixin.Builder.create(CfnLaunchTemplateMixinProps.builder()
         .launchTemplateData(LaunchTemplateDataProperty.builder()
                 .blockDeviceMappings(List.of(BlockDeviceMappingProperty.builder()
                         .deviceName("deviceName")
                         .ebs(EbsProperty.builder()
                                 .deleteOnTermination(false)
                                 .ebsCardIndex(123)
                                 .encrypted(false)
                                 .iops(123)
                                 .kmsKeyId("kmsKeyId")
                                 .snapshotId("snapshotId")
                                 .throughput(123)
                                 .volumeInitializationRate(123)
                                 .volumeSize(123)
                                 .volumeType("volumeType")
                                 .build())
                         .noDevice("noDevice")
                         .virtualName("virtualName")
                         .build()))
                 .capacityReservationSpecification(CapacityReservationSpecificationProperty.builder()
                         .capacityReservationPreference("capacityReservationPreference")
                         .capacityReservationTarget(CapacityReservationTargetProperty.builder()
                                 .capacityReservationId("capacityReservationId")
                                 .capacityReservationResourceGroupArn("capacityReservationResourceGroupArn")
                                 .build())
                         .build())
                 .cpuOptions(CpuOptionsProperty.builder()
                         .amdSevSnp("amdSevSnp")
                         .coreCount(123)
                         .threadsPerCore(123)
                         .build())
                 .creditSpecification(CreditSpecificationProperty.builder()
                         .cpuCredits("cpuCredits")
                         .build())
                 .disableApiStop(false)
                 .disableApiTermination(false)
                 .ebsOptimized(false)
                 .elasticGpuSpecifications(List.of(ElasticGpuSpecificationProperty.builder()
                         .type("type")
                         .build()))
                 .elasticInferenceAccelerators(List.of(LaunchTemplateElasticInferenceAcceleratorProperty.builder()
                         .count(123)
                         .type("type")
                         .build()))
                 .enclaveOptions(EnclaveOptionsProperty.builder()
                         .enabled(false)
                         .build())
                 .hibernationOptions(HibernationOptionsProperty.builder()
                         .configured(false)
                         .build())
                 .iamInstanceProfile(IamInstanceProfileProperty.builder()
                         .arn("arn")
                         .name("name")
                         .build())
                 .imageId("imageId")
                 .instanceInitiatedShutdownBehavior("instanceInitiatedShutdownBehavior")
                 .instanceMarketOptions(InstanceMarketOptionsProperty.builder()
                         .marketType("marketType")
                         .spotOptions(SpotOptionsProperty.builder()
                                 .blockDurationMinutes(123)
                                 .instanceInterruptionBehavior("instanceInterruptionBehavior")
                                 .maxPrice("maxPrice")
                                 .spotInstanceType("spotInstanceType")
                                 .validUntil("validUntil")
                                 .build())
                         .build())
                 .instanceRequirements(InstanceRequirementsProperty.builder()
                         .acceleratorCount(AcceleratorCountProperty.builder()
                                 .max(123)
                                 .min(123)
                                 .build())
                         .acceleratorManufacturers(List.of("acceleratorManufacturers"))
                         .acceleratorNames(List.of("acceleratorNames"))
                         .acceleratorTotalMemoryMiB(AcceleratorTotalMemoryMiBProperty.builder()
                                 .max(123)
                                 .min(123)
                                 .build())
                         .acceleratorTypes(List.of("acceleratorTypes"))
                         .allowedInstanceTypes(List.of("allowedInstanceTypes"))
                         .bareMetal("bareMetal")
                         .baselineEbsBandwidthMbps(BaselineEbsBandwidthMbpsProperty.builder()
                                 .max(123)
                                 .min(123)
                                 .build())
                         .baselinePerformanceFactors(BaselinePerformanceFactorsProperty.builder()
                                 .cpu(CpuProperty.builder()
                                         .references(List.of(ReferenceProperty.builder()
                                                 .instanceFamily("instanceFamily")
                                                 .build()))
                                         .build())
                                 .build())
                         .burstablePerformance("burstablePerformance")
                         .cpuManufacturers(List.of("cpuManufacturers"))
                         .excludedInstanceTypes(List.of("excludedInstanceTypes"))
                         .instanceGenerations(List.of("instanceGenerations"))
                         .localStorage("localStorage")
                         .localStorageTypes(List.of("localStorageTypes"))
                         .maxSpotPriceAsPercentageOfOptimalOnDemandPrice(123)
                         .memoryGiBPerVCpu(MemoryGiBPerVCpuProperty.builder()
                                 .max(123)
                                 .min(123)
                                 .build())
                         .memoryMiB(MemoryMiBProperty.builder()
                                 .max(123)
                                 .min(123)
                                 .build())
                         .networkBandwidthGbps(NetworkBandwidthGbpsProperty.builder()
                                 .max(123)
                                 .min(123)
                                 .build())
                         .networkInterfaceCount(NetworkInterfaceCountProperty.builder()
                                 .max(123)
                                 .min(123)
                                 .build())
                         .onDemandMaxPricePercentageOverLowestPrice(123)
                         .requireHibernateSupport(false)
                         .spotMaxPricePercentageOverLowestPrice(123)
                         .totalLocalStorageGb(TotalLocalStorageGBProperty.builder()
                                 .max(123)
                                 .min(123)
                                 .build())
                         .vCpuCount(VCpuCountProperty.builder()
                                 .max(123)
                                 .min(123)
                                 .build())
                         .build())
                 .instanceType("instanceType")
                 .kernelId("kernelId")
                 .keyName("keyName")
                 .licenseSpecifications(List.of(LicenseSpecificationProperty.builder()
                         .licenseConfigurationArn("licenseConfigurationArn")
                         .build()))
                 .maintenanceOptions(MaintenanceOptionsProperty.builder()
                         .autoRecovery("autoRecovery")
                         .build())
                 .metadataOptions(MetadataOptionsProperty.builder()
                         .httpEndpoint("httpEndpoint")
                         .httpProtocolIpv6("httpProtocolIpv6")
                         .httpPutResponseHopLimit(123)
                         .httpTokens("httpTokens")
                         .instanceMetadataTags("instanceMetadataTags")
                         .build())
                 .monitoring(MonitoringProperty.builder()
                         .enabled(false)
                         .build())
                 .networkInterfaces(List.of(NetworkInterfaceProperty.builder()
                         .associateCarrierIpAddress(false)
                         .associatePublicIpAddress(false)
                         .connectionTrackingSpecification(ConnectionTrackingSpecificationProperty.builder()
                                 .tcpEstablishedTimeout(123)
                                 .udpStreamTimeout(123)
                                 .udpTimeout(123)
                                 .build())
                         .deleteOnTermination(false)
                         .description("description")
                         .deviceIndex(123)
                         .enaQueueCount(123)
                         .enaSrdSpecification(EnaSrdSpecificationProperty.builder()
                                 .enaSrdEnabled(false)
                                 .enaSrdUdpSpecification(EnaSrdUdpSpecificationProperty.builder()
                                         .enaSrdUdpEnabled(false)
                                         .build())
                                 .build())
                         .groups(List.of("groups"))
                         .interfaceType("interfaceType")
                         .ipv4PrefixCount(123)
                         .ipv4Prefixes(List.of(Ipv4PrefixSpecificationProperty.builder()
                                 .ipv4Prefix("ipv4Prefix")
                                 .build()))
                         .ipv6AddressCount(123)
                         .ipv6Addresses(List.of(Ipv6AddProperty.builder()
                                 .ipv6Address("ipv6Address")
                                 .build()))
                         .ipv6PrefixCount(123)
                         .ipv6Prefixes(List.of(Ipv6PrefixSpecificationProperty.builder()
                                 .ipv6Prefix("ipv6Prefix")
                                 .build()))
                         .networkCardIndex(123)
                         .networkInterfaceId("networkInterfaceId")
                         .primaryIpv6(false)
                         .privateIpAddress("privateIpAddress")
                         .privateIpAddresses(List.of(PrivateIpAddProperty.builder()
                                 .primary(false)
                                 .privateIpAddress("privateIpAddress")
                                 .build()))
                         .secondaryPrivateIpAddressCount(123)
                         .subnetId("subnetId")
                         .build()))
                 .networkPerformanceOptions(NetworkPerformanceOptionsProperty.builder()
                         .bandwidthWeighting("bandwidthWeighting")
                         .build())
                 .placement(PlacementProperty.builder()
                         .affinity("affinity")
                         .availabilityZone("availabilityZone")
                         .groupId("groupId")
                         .groupName("groupName")
                         .hostId("hostId")
                         .hostResourceGroupArn("hostResourceGroupArn")
                         .partitionNumber(123)
                         .spreadDomain("spreadDomain")
                         .tenancy("tenancy")
                         .build())
                 .privateDnsNameOptions(PrivateDnsNameOptionsProperty.builder()
                         .enableResourceNameDnsAaaaRecord(false)
                         .enableResourceNameDnsARecord(false)
                         .hostnameType("hostnameType")
                         .build())
                 .ramDiskId("ramDiskId")
                 .securityGroupIds(List.of("securityGroupIds"))
                 .securityGroups(List.of("securityGroups"))
                 .tagSpecifications(List.of(TagSpecificationProperty.builder()
                         .resourceType("resourceType")
                         .tags(List.of(CfnTag.builder()
                                 .key("key")
                                 .value("value")
                                 .build()))
                         .build()))
                 .userData("userData")
                 .build())
         .launchTemplateName("launchTemplateName")
         .tagSpecifications(List.of(LaunchTemplateTagSpecificationProperty.builder()
                 .resourceType("resourceType")
                 .tags(List.of(CfnTag.builder()
                         .key("key")
                         .value("value")
                         .build()))
                 .build()))
         .versionDescription("versionDescription")
         .build())
 .strategy(mergeStrategy)
 .build();
 

See Also:
  • Field Details

    • CFN_PROPERTY_KEYS

      @Stability(Stable) protected static final List<String> CFN_PROPERTY_KEYS
  • Constructor Details

    • CfnLaunchTemplatePropsMixin

      protected CfnLaunchTemplatePropsMixin(software.amazon.jsii.JsiiObjectRef objRef)
    • CfnLaunchTemplatePropsMixin

      protected CfnLaunchTemplatePropsMixin(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • CfnLaunchTemplatePropsMixin

      @Stability(Stable) public CfnLaunchTemplatePropsMixin(@NotNull CfnLaunchTemplateMixinProps props, @Nullable CfnPropertyMixinOptions options)
      Create a mixin to apply properties to AWS::EC2::LaunchTemplate.

      Parameters:
      props - L1 properties to apply. This parameter is required.
      options - Mixin options.
    • CfnLaunchTemplatePropsMixin

      @Stability(Stable) public CfnLaunchTemplatePropsMixin(@NotNull CfnLaunchTemplateMixinProps props)
      Create a mixin to apply properties to AWS::EC2::LaunchTemplate.

      Parameters:
      props - L1 properties to apply. This parameter is required.
  • Method Details

    • applyTo

      @Stability(Stable) public void applyTo(@NotNull software.constructs.IConstruct construct)
      Apply the mixin properties to the construct.

      Specified by:
      applyTo in interface software.constructs.IMixin
      Specified by:
      applyTo in class Mixin
      Parameters:
      construct - This parameter is required.
    • supports

      @Stability(Stable) @NotNull public Boolean supports(@NotNull software.constructs.IConstruct construct)
      Check if this mixin supports the given construct.

      Specified by:
      supports in interface software.constructs.IMixin
      Overrides:
      supports in class Mixin
      Parameters:
      construct - This parameter is required.
    • getProps

      @Stability(Stable) @NotNull protected CfnLaunchTemplateMixinProps getProps()
    • getStrategy

      @Stability(Stable) @NotNull protected IMergeStrategy getStrategy()