aws-cdk-lib.aws_ec2.CfnLaunchTemplate.LaunchTemplateDataProperty

interface LaunchTemplateDataProperty

LanguageType name
.NETAmazon.CDK.AWS.EC2.CfnLaunchTemplate.LaunchTemplateDataProperty
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#CfnLaunchTemplate_LaunchTemplateDataProperty
Javasoftware.amazon.awscdk.services.ec2.CfnLaunchTemplate.LaunchTemplateDataProperty
Pythonaws_cdk.aws_ec2.CfnLaunchTemplate.LaunchTemplateDataProperty
TypeScript aws-cdk-lib » aws_ec2 » CfnLaunchTemplate » LaunchTemplateDataProperty

The information to include in the launch template.

You must specify at least one parameter for the launch template data.

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const launchTemplateDataProperty: ec2.CfnLaunchTemplate.LaunchTemplateDataProperty = {
  blockDeviceMappings: [{
    deviceName: 'deviceName',
    ebs: {
      deleteOnTermination: false,
      encrypted: false,
      iops: 123,
      kmsKeyId: 'kmsKeyId',
      snapshotId: 'snapshotId',
      throughput: 123,
      volumeSize: 123,
      volumeType: 'volumeType',
    },
    noDevice: 'noDevice',
    virtualName: 'virtualName',
  }],
  capacityReservationSpecification: {
    capacityReservationPreference: 'capacityReservationPreference',
    capacityReservationTarget: {
      capacityReservationId: 'capacityReservationId',
      capacityReservationResourceGroupArn: 'capacityReservationResourceGroupArn',
    },
  },
  cpuOptions: {
    amdSevSnp: 'amdSevSnp',
    coreCount: 123,
    threadsPerCore: 123,
  },
  creditSpecification: {
    cpuCredits: 'cpuCredits',
  },
  disableApiStop: false,
  disableApiTermination: false,
  ebsOptimized: false,
  elasticGpuSpecifications: [{
    type: 'type',
  }],
  elasticInferenceAccelerators: [{
    count: 123,
    type: 'type',
  }],
  enclaveOptions: {
    enabled: false,
  },
  hibernationOptions: {
    configured: false,
  },
  iamInstanceProfile: {
    arn: 'arn',
    name: 'name',
  },
  imageId: 'imageId',
  instanceInitiatedShutdownBehavior: 'instanceInitiatedShutdownBehavior',
  instanceMarketOptions: {
    marketType: 'marketType',
    spotOptions: {
      blockDurationMinutes: 123,
      instanceInterruptionBehavior: 'instanceInterruptionBehavior',
      maxPrice: 'maxPrice',
      spotInstanceType: 'spotInstanceType',
      validUntil: 'validUntil',
    },
  },
  instanceRequirements: {
    acceleratorCount: {
      max: 123,
      min: 123,
    },
    acceleratorManufacturers: ['acceleratorManufacturers'],
    acceleratorNames: ['acceleratorNames'],
    acceleratorTotalMemoryMiB: {
      max: 123,
      min: 123,
    },
    acceleratorTypes: ['acceleratorTypes'],
    allowedInstanceTypes: ['allowedInstanceTypes'],
    bareMetal: 'bareMetal',
    baselineEbsBandwidthMbps: {
      max: 123,
      min: 123,
    },
    burstablePerformance: 'burstablePerformance',
    cpuManufacturers: ['cpuManufacturers'],
    excludedInstanceTypes: ['excludedInstanceTypes'],
    instanceGenerations: ['instanceGenerations'],
    localStorage: 'localStorage',
    localStorageTypes: ['localStorageTypes'],
    memoryGiBPerVCpu: {
      max: 123,
      min: 123,
    },
    memoryMiB: {
      max: 123,
      min: 123,
    },
    networkBandwidthGbps: {
      max: 123,
      min: 123,
    },
    networkInterfaceCount: {
      max: 123,
      min: 123,
    },
    onDemandMaxPricePercentageOverLowestPrice: 123,
    requireHibernateSupport: false,
    spotMaxPricePercentageOverLowestPrice: 123,
    totalLocalStorageGb: {
      max: 123,
      min: 123,
    },
    vCpuCount: {
      max: 123,
      min: 123,
    },
  },
  instanceType: 'instanceType',
  kernelId: 'kernelId',
  keyName: 'keyName',
  licenseSpecifications: [{
    licenseConfigurationArn: 'licenseConfigurationArn',
  }],
  maintenanceOptions: {
    autoRecovery: 'autoRecovery',
  },
  metadataOptions: {
    httpEndpoint: 'httpEndpoint',
    httpProtocolIpv6: 'httpProtocolIpv6',
    httpPutResponseHopLimit: 123,
    httpTokens: 'httpTokens',
    instanceMetadataTags: 'instanceMetadataTags',
  },
  monitoring: {
    enabled: false,
  },
  networkInterfaces: [{
    associateCarrierIpAddress: false,
    associatePublicIpAddress: false,
    deleteOnTermination: false,
    description: 'description',
    deviceIndex: 123,
    groups: ['groups'],
    interfaceType: 'interfaceType',
    ipv4PrefixCount: 123,
    ipv4Prefixes: [{
      ipv4Prefix: 'ipv4Prefix',
    }],
    ipv6AddressCount: 123,
    ipv6Addresses: [{
      ipv6Address: 'ipv6Address',
    }],
    ipv6PrefixCount: 123,
    ipv6Prefixes: [{
      ipv6Prefix: 'ipv6Prefix',
    }],
    networkCardIndex: 123,
    networkInterfaceId: 'networkInterfaceId',
    privateIpAddress: 'privateIpAddress',
    privateIpAddresses: [{
      primary: false,
      privateIpAddress: 'privateIpAddress',
    }],
    secondaryPrivateIpAddressCount: 123,
    subnetId: 'subnetId',
  }],
  placement: {
    affinity: 'affinity',
    availabilityZone: 'availabilityZone',
    groupId: 'groupId',
    groupName: 'groupName',
    hostId: 'hostId',
    hostResourceGroupArn: 'hostResourceGroupArn',
    partitionNumber: 123,
    spreadDomain: 'spreadDomain',
    tenancy: 'tenancy',
  },
  privateDnsNameOptions: {
    enableResourceNameDnsAaaaRecord: false,
    enableResourceNameDnsARecord: false,
    hostnameType: 'hostnameType',
  },
  ramDiskId: 'ramDiskId',
  securityGroupIds: ['securityGroupIds'],
  securityGroups: ['securityGroups'],
  tagSpecifications: [{
    resourceType: 'resourceType',
    tags: [{
      key: 'key',
      value: 'value',
    }],
  }],
  userData: 'userData',
};

Properties

NameTypeDescription
blockDeviceMappings?IResolvable | IResolvable | BlockDeviceMappingProperty[]The block device mapping.
capacityReservationSpecification?IResolvable | CapacityReservationSpecificationPropertyThe Capacity Reservation targeting option.
cpuOptions?IResolvable | CpuOptionsPropertyThe CPU options for the instance.
creditSpecification?IResolvable | CreditSpecificationPropertyThe credit option for CPU usage of the instance.
disableApiStop?boolean | IResolvableIndicates whether to enable the instance for stop protection.
disableApiTermination?boolean | IResolvableIf you set this parameter to true , you can't terminate the instance using the Amazon EC2 console, CLI, or API;
ebsOptimized?boolean | IResolvableIndicates whether the instance is optimized for Amazon EBS I/O.
elasticGpuSpecifications?IResolvable | IResolvable | ElasticGpuSpecificationProperty[]An elastic GPU to associate with the instance.
elasticInferenceAccelerators?IResolvable | IResolvable | LaunchTemplateElasticInferenceAcceleratorProperty[]The elastic inference accelerator for the instance.
enclaveOptions?IResolvable | EnclaveOptionsPropertyIndicates whether the instance is enabled for AWS Nitro Enclaves.
hibernationOptions?IResolvable | HibernationOptionsPropertyIndicates whether an instance is enabled for hibernation.
iamInstanceProfile?IResolvable | IamInstanceProfilePropertyThe name or Amazon Resource Name (ARN) of an IAM instance profile.
imageId?stringThe ID of the AMI.
instanceInitiatedShutdownBehavior?stringIndicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
instanceMarketOptions?IResolvable | InstanceMarketOptionsPropertyThe market (purchasing) option for the instances.
instanceRequirements?IResolvable | InstanceRequirementsPropertyThe attributes for the instance types.
instanceType?stringThe instance type. For more information, see Instance types in the Amazon Elastic Compute Cloud User Guide .
kernelId?stringThe ID of the kernel.
keyName?stringThe name of the key pair. You can create a key pair using CreateKeyPair or ImportKeyPair .
licenseSpecifications?IResolvable | IResolvable | LicenseSpecificationProperty[]The license configurations.
maintenanceOptions?IResolvable | MaintenanceOptionsPropertyThe maintenance options of your instance.
metadataOptions?IResolvable | MetadataOptionsPropertyThe metadata options for the instance.
monitoring?IResolvable | MonitoringPropertyThe monitoring for the instance.
networkInterfaces?IResolvable | IResolvable | NetworkInterfaceProperty[]One or more network interfaces.
placement?IResolvable | PlacementPropertyThe placement for the instance.
privateDnsNameOptions?IResolvable | PrivateDnsNameOptionsPropertyThe hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries should be handled.
ramDiskId?stringThe ID of the RAM disk.
securityGroupIds?string[]The IDs of the security groups.
securityGroups?string[]One or more security group names.
tagSpecifications?IResolvable | IResolvable | TagSpecificationProperty[]The tags to apply to the resources that are created during instance launch.
userData?stringThe user data to make available to the instance.

blockDeviceMappings?

Type: IResolvable | IResolvable | BlockDeviceMappingProperty[] (optional)

The block device mapping.


capacityReservationSpecification?

Type: IResolvable | CapacityReservationSpecificationProperty (optional)

The Capacity Reservation targeting option.

If you do not specify this parameter, the instance's Capacity Reservation preference defaults to open , which enables it to run in any open Capacity Reservation that has matching attributes (instance type, platform, Availability Zone).


cpuOptions?

Type: IResolvable | CpuOptionsProperty (optional)

The CPU options for the instance.

For more information, see Optimizing CPU Options in the Amazon Elastic Compute Cloud User Guide .


creditSpecification?

Type: IResolvable | CreditSpecificationProperty (optional)

The credit option for CPU usage of the instance.

Valid only for T instances.


disableApiStop?

Type: boolean | IResolvable (optional)

Indicates whether to enable the instance for stop protection.

For more information, see Stop protection in the Amazon Elastic Compute Cloud User Guide .


disableApiTermination?

Type: boolean | IResolvable (optional)

If you set this parameter to true , you can't terminate the instance using the Amazon EC2 console, CLI, or API;

otherwise, you can. To change this attribute after launch, use ModifyInstanceAttribute . Alternatively, if you set InstanceInitiatedShutdownBehavior to terminate , you can terminate the instance by running the shutdown command from the instance.


ebsOptimized?

Type: boolean | IResolvable (optional)

Indicates whether the instance is optimized for Amazon EBS I/O.

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.


elasticGpuSpecifications?

Type: IResolvable | IResolvable | ElasticGpuSpecificationProperty[] (optional)

An elastic GPU to associate with the instance.


elasticInferenceAccelerators?

Type: IResolvable | IResolvable | LaunchTemplateElasticInferenceAcceleratorProperty[] (optional)

The elastic inference accelerator for the instance.


enclaveOptions?

Type: IResolvable | EnclaveOptionsProperty (optional)

Indicates whether the instance is enabled for AWS Nitro Enclaves.

For more information, see What is AWS Nitro Enclaves? in the AWS Nitro Enclaves User Guide .

You can't enable AWS Nitro Enclaves and hibernation on the same instance.


hibernationOptions?

Type: IResolvable | HibernationOptionsProperty (optional)

Indicates whether an instance is enabled for hibernation.

This parameter is valid only if the instance meets the hibernation prerequisites . For more information, see Hibernate your instance in the Amazon Elastic Compute Cloud User Guide .


iamInstanceProfile?

Type: IResolvable | IamInstanceProfileProperty (optional)

The name or Amazon Resource Name (ARN) of an IAM instance profile.


imageId?

Type: string (optional)

The ID of the AMI.

Alternatively, you can specify a Systems Manager parameter, which will resolve to an AMI ID on launch.

Valid formats:

  • ami-17characters00000
  • resolve:ssm:parameter-name
  • resolve:ssm:parameter-name:version-number
  • resolve:ssm:parameter-name:label

For more information, see Use a Systems Manager parameter to find an AMI in the Amazon Elastic Compute Cloud User Guide .


instanceInitiatedShutdownBehavior?

Type: string (optional)

Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).

Default: stop


instanceMarketOptions?

Type: IResolvable | InstanceMarketOptionsProperty (optional)

The market (purchasing) option for the instances.


instanceRequirements?

Type: IResolvable | InstanceRequirementsProperty (optional)

The attributes for the instance types.

When you specify instance attributes, Amazon EC2 will identify instance types with these attributes.

If you specify InstanceRequirements , you can't specify InstanceType .


instanceType?

Type: string (optional)

The instance type. For more information, see Instance types in the Amazon Elastic Compute Cloud User Guide .

If you specify InstanceType , you can't specify InstanceRequirements .


kernelId?

Type: string (optional)

The ID of the kernel.

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see User Provided Kernels in the Amazon EC2 User Guide .


keyName?

Type: string (optional)

The name of the key pair. You can create a key pair using CreateKeyPair or ImportKeyPair .

If you do not specify a key pair, you can't connect to the instance unless you choose an AMI that is configured to allow users another way to log in.


licenseSpecifications?

Type: IResolvable | IResolvable | LicenseSpecificationProperty[] (optional)

The license configurations.


maintenanceOptions?

Type: IResolvable | MaintenanceOptionsProperty (optional)

The maintenance options of your instance.


metadataOptions?

Type: IResolvable | MetadataOptionsProperty (optional)

The metadata options for the instance.

For more information, see Instance metadata and user data in the Amazon Elastic Compute Cloud User Guide .


monitoring?

Type: IResolvable | MonitoringProperty (optional)

The monitoring for the instance.


networkInterfaces?

Type: IResolvable | IResolvable | NetworkInterfaceProperty[] (optional)

One or more network interfaces.

If you specify a network interface, you must specify any security groups and subnets as part of the network interface.


placement?

Type: IResolvable | PlacementProperty (optional)

The placement for the instance.


privateDnsNameOptions?

Type: IResolvable | PrivateDnsNameOptionsProperty (optional)

The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries should be handled.

For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .


ramDiskId?

Type: string (optional)

The ID of the RAM disk.

We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see User provided kernels in the Amazon Elastic Compute Cloud User Guide .


securityGroupIds?

Type: string[] (optional)

The IDs of the security groups.

You can specify the IDs of existing security groups and references to resources created by the stack template.


securityGroups?

Type: string[] (optional)

One or more security group names.

For a nondefault VPC, you must use security group IDs instead. You cannot specify both a security group ID and security name in the same request.


tagSpecifications?

Type: IResolvable | IResolvable | TagSpecificationProperty[] (optional)

The tags to apply to the resources that are created during instance launch.

You can specify tags for the following resources only:

  • Instances
  • Volumes
  • Elastic graphics
  • Spot Instance requests
  • Network interfaces

To tag a resource after it has been created, see CreateTags .

To tag the launch template itself, you must use the TagSpecification parameter.


userData?

Type: string (optional)

The user data to make available to the instance.

You must provide base64-encoded text. User data is limited to 16 KB. For more information, see Run commands on your Linux instance at launch (Linux) or Work with instance user data (Windows) in the Amazon Elastic Compute Cloud User Guide .

If you are creating the launch template for use with AWS Batch , the user data must be provided in the MIME multi-part archive format . For more information, see Amazon EC2 user data in launch templates in the AWS Batch User Guide .