Interface CfnLaunchTemplate.ILaunchTemplateDataProperty
The information to include in the launch template.
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public interface CfnLaunchTemplate.ILaunchTemplateDataProperty
Syntax (vb)
Public Interface CfnLaunchTemplate.ILaunchTemplateDataProperty
Remarks
You must specify at least one parameter for the launch template data.
ExampleMetadata: fixture=_generated
Examples
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;
var launchTemplateDataProperty = new LaunchTemplateDataProperty {
BlockDeviceMappings = new [] { new BlockDeviceMappingProperty {
DeviceName = "deviceName",
Ebs = new EbsProperty {
DeleteOnTermination = false,
Encrypted = false,
Iops = 123,
KmsKeyId = "kmsKeyId",
SnapshotId = "snapshotId",
Throughput = 123,
VolumeInitializationRate = 123,
VolumeSize = 123,
VolumeType = "volumeType"
},
NoDevice = "noDevice",
VirtualName = "virtualName"
} },
CapacityReservationSpecification = new CapacityReservationSpecificationProperty {
CapacityReservationPreference = "capacityReservationPreference",
CapacityReservationTarget = new CapacityReservationTargetProperty {
CapacityReservationId = "capacityReservationId",
CapacityReservationResourceGroupArn = "capacityReservationResourceGroupArn"
}
},
CpuOptions = new CpuOptionsProperty {
AmdSevSnp = "amdSevSnp",
CoreCount = 123,
ThreadsPerCore = 123
},
CreditSpecification = new CreditSpecificationProperty {
CpuCredits = "cpuCredits"
},
DisableApiStop = false,
DisableApiTermination = false,
EbsOptimized = false,
ElasticGpuSpecifications = new [] { new ElasticGpuSpecificationProperty {
Type = "type"
} },
ElasticInferenceAccelerators = new [] { new LaunchTemplateElasticInferenceAcceleratorProperty {
Count = 123,
Type = "type"
} },
EnclaveOptions = new EnclaveOptionsProperty {
Enabled = false
},
HibernationOptions = new HibernationOptionsProperty {
Configured = false
},
IamInstanceProfile = new IamInstanceProfileProperty {
Arn = "arn",
Name = "name"
},
ImageId = "imageId",
InstanceInitiatedShutdownBehavior = "instanceInitiatedShutdownBehavior",
InstanceMarketOptions = new InstanceMarketOptionsProperty {
MarketType = "marketType",
SpotOptions = new SpotOptionsProperty {
BlockDurationMinutes = 123,
InstanceInterruptionBehavior = "instanceInterruptionBehavior",
MaxPrice = "maxPrice",
SpotInstanceType = "spotInstanceType",
ValidUntil = "validUntil"
}
},
InstanceRequirements = new InstanceRequirementsProperty {
AcceleratorCount = new AcceleratorCountProperty {
Max = 123,
Min = 123
},
AcceleratorManufacturers = new [] { "acceleratorManufacturers" },
AcceleratorNames = new [] { "acceleratorNames" },
AcceleratorTotalMemoryMiB = new AcceleratorTotalMemoryMiBProperty {
Max = 123,
Min = 123
},
AcceleratorTypes = new [] { "acceleratorTypes" },
AllowedInstanceTypes = new [] { "allowedInstanceTypes" },
BareMetal = "bareMetal",
BaselineEbsBandwidthMbps = new BaselineEbsBandwidthMbpsProperty {
Max = 123,
Min = 123
},
BaselinePerformanceFactors = new BaselinePerformanceFactorsProperty {
Cpu = new CpuProperty {
References = new [] { new ReferenceProperty {
InstanceFamily = "instanceFamily"
} }
}
},
BurstablePerformance = "burstablePerformance",
CpuManufacturers = new [] { "cpuManufacturers" },
ExcludedInstanceTypes = new [] { "excludedInstanceTypes" },
InstanceGenerations = new [] { "instanceGenerations" },
LocalStorage = "localStorage",
LocalStorageTypes = new [] { "localStorageTypes" },
MaxSpotPriceAsPercentageOfOptimalOnDemandPrice = 123,
MemoryGiBPerVCpu = new MemoryGiBPerVCpuProperty {
Max = 123,
Min = 123
},
MemoryMiB = new MemoryMiBProperty {
Max = 123,
Min = 123
},
NetworkBandwidthGbps = new NetworkBandwidthGbpsProperty {
Max = 123,
Min = 123
},
NetworkInterfaceCount = new NetworkInterfaceCountProperty {
Max = 123,
Min = 123
},
OnDemandMaxPricePercentageOverLowestPrice = 123,
RequireHibernateSupport = false,
SpotMaxPricePercentageOverLowestPrice = 123,
TotalLocalStorageGb = new TotalLocalStorageGBProperty {
Max = 123,
Min = 123
},
VCpuCount = new VCpuCountProperty {
Max = 123,
Min = 123
}
},
InstanceType = "instanceType",
KernelId = "kernelId",
KeyName = "keyName",
LicenseSpecifications = new [] { new LicenseSpecificationProperty {
LicenseConfigurationArn = "licenseConfigurationArn"
} },
MaintenanceOptions = new MaintenanceOptionsProperty {
AutoRecovery = "autoRecovery"
},
MetadataOptions = new MetadataOptionsProperty {
HttpEndpoint = "httpEndpoint",
HttpProtocolIpv6 = "httpProtocolIpv6",
HttpPutResponseHopLimit = 123,
HttpTokens = "httpTokens",
InstanceMetadataTags = "instanceMetadataTags"
},
Monitoring = new MonitoringProperty {
Enabled = false
},
NetworkInterfaces = new [] { new NetworkInterfaceProperty {
AssociateCarrierIpAddress = false,
AssociatePublicIpAddress = false,
ConnectionTrackingSpecification = new ConnectionTrackingSpecificationProperty {
TcpEstablishedTimeout = 123,
UdpStreamTimeout = 123,
UdpTimeout = 123
},
DeleteOnTermination = false,
Description = "description",
DeviceIndex = 123,
EnaQueueCount = 123,
EnaSrdSpecification = new EnaSrdSpecificationProperty {
EnaSrdEnabled = false,
EnaSrdUdpSpecification = new EnaSrdUdpSpecificationProperty {
EnaSrdUdpEnabled = false
}
},
Groups = new [] { "groups" },
InterfaceType = "interfaceType",
Ipv4PrefixCount = 123,
Ipv4Prefixes = new [] { new Ipv4PrefixSpecificationProperty {
Ipv4Prefix = "ipv4Prefix"
} },
Ipv6AddressCount = 123,
Ipv6Addresses = new [] { new Ipv6AddProperty {
Ipv6Address = "ipv6Address"
} },
Ipv6PrefixCount = 123,
Ipv6Prefixes = new [] { new Ipv6PrefixSpecificationProperty {
Ipv6Prefix = "ipv6Prefix"
} },
NetworkCardIndex = 123,
NetworkInterfaceId = "networkInterfaceId",
PrimaryIpv6 = false,
PrivateIpAddress = "privateIpAddress",
PrivateIpAddresses = new [] { new PrivateIpAddProperty {
Primary = false,
PrivateIpAddress = "privateIpAddress"
} },
SecondaryPrivateIpAddressCount = 123,
SubnetId = "subnetId"
} },
NetworkPerformanceOptions = new NetworkPerformanceOptionsProperty {
BandwidthWeighting = "bandwidthWeighting"
},
Placement = new PlacementProperty {
Affinity = "affinity",
AvailabilityZone = "availabilityZone",
GroupId = "groupId",
GroupName = "groupName",
HostId = "hostId",
HostResourceGroupArn = "hostResourceGroupArn",
PartitionNumber = 123,
SpreadDomain = "spreadDomain",
Tenancy = "tenancy"
},
PrivateDnsNameOptions = new PrivateDnsNameOptionsProperty {
EnableResourceNameDnsAaaaRecord = false,
EnableResourceNameDnsARecord = false,
HostnameType = "hostnameType"
},
RamDiskId = "ramDiskId",
SecurityGroupIds = new [] { "securityGroupIds" },
SecurityGroups = new [] { "securityGroups" },
TagSpecifications = new [] { new TagSpecificationProperty {
ResourceType = "resourceType",
Tags = new [] { new CfnTag {
Key = "key",
Value = "value"
} }
} },
UserData = "userData"
};
Synopsis
Properties
| BlockDeviceMappings | The block device mapping. |
| CapacityReservationSpecification | The Capacity Reservation targeting option. |
| CpuOptions | The CPU options for the instance. |
| CreditSpecification | The credit option for CPU usage of the instance. |
| DisableApiStop | Indicates whether to enable the instance for stop protection. |
| DisableApiTermination | Indicates whether termination protection is enabled for the instance. |
| EbsOptimized | Indicates whether the instance is optimized for Amazon EBS I/O. |
| ElasticGpuSpecifications | The information to include in the launch template. |
| ElasticInferenceAccelerators | The information to include in the launch template. |
| EnclaveOptions | Indicates whether the instance is enabled for AWS Nitro Enclaves. |
| HibernationOptions | Indicates whether an instance is enabled for hibernation. |
| IamInstanceProfile | The name or Amazon Resource Name (ARN) of an IAM instance profile. |
| ImageId | The ID of the AMI. |
| InstanceInitiatedShutdownBehavior | Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown). |
| InstanceMarketOptions | The market (purchasing) option for the instances. |
| InstanceRequirements | The attributes for the instance types. |
| InstanceType | The instance type. For more information, see Amazon EC2 instance types in the Amazon EC2 User Guide . |
| KernelId | The ID of the kernel. |
| KeyName | The name of the key pair. You can create a key pair using CreateKeyPair or ImportKeyPair . |
| LicenseSpecifications | The license configurations. |
| MaintenanceOptions | The maintenance options of your instance. |
| MetadataOptions | The metadata options for the instance. |
| Monitoring | The monitoring for the instance. |
| NetworkInterfaces | The network interfaces for the instance. |
| NetworkPerformanceOptions | The settings for the network performance options for the instance. |
| Placement | The placement for the instance. |
| PrivateDnsNameOptions | The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries should be handled. |
| RamDiskId | The ID of the RAM disk. |
| SecurityGroupIds | The IDs of the security groups. |
| SecurityGroups | The names of the security groups. For a nondefault VPC, you must use security group IDs instead. |
| TagSpecifications | The tags to apply to resources that are created during instance launch. |
| UserData | The user data to make available to the instance. |
Properties
BlockDeviceMappings
The block device mapping.
object? BlockDeviceMappings { get; }
Property Value
Remarks
CapacityReservationSpecification
The Capacity Reservation targeting option.
object? CapacityReservationSpecification { get; }
Property Value
Remarks
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).
Type union: either IResolvable or CfnLaunchTemplate.ICapacityReservationSpecificationProperty
CpuOptions
The CPU options for the instance.
object? CpuOptions { get; }
Property Value
Remarks
For more information, see CPU options for Amazon EC2 instances in the Amazon EC2 User Guide .
Type union: either IResolvable or CfnLaunchTemplate.ICpuOptionsProperty
CreditSpecification
The credit option for CPU usage of the instance.
object? CreditSpecification { get; }
Property Value
Remarks
DisableApiStop
Indicates whether to enable the instance for stop protection.
object? DisableApiStop { get; }
Property Value
Remarks
For more information, see Enable stop protection for your EC2 instances in the Amazon EC2 User Guide .
Type union: either bool or IResolvable
DisableApiTermination
Indicates whether termination protection is enabled for the instance.
object? DisableApiTermination { get; }
Property Value
Remarks
The default is false , which means that you can terminate the instance using the Amazon EC2 console, command line tools, or API. You can enable termination protection when you launch an instance, while the instance is running, or while the instance is stopped.
Type union: either bool or IResolvable
EbsOptimized
Indicates whether the instance is optimized for Amazon EBS I/O.
object? EbsOptimized { get; }
Property Value
Remarks
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.
Type union: either bool or IResolvable
ElasticGpuSpecifications
The information to include in the launch template.
object? ElasticGpuSpecifications { get; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnLaunchTemplate.IElasticGpuSpecificationProperty)[]
ElasticInferenceAccelerators
The information to include in the launch template.
object? ElasticInferenceAccelerators { get; }
Property Value
Remarks
Type union: either IResolvable or (either IResolvable or CfnLaunchTemplate.ILaunchTemplateElasticInferenceAcceleratorProperty)[]
EnclaveOptions
Indicates whether the instance is enabled for AWS Nitro Enclaves.
object? EnclaveOptions { get; }
Property Value
Remarks
For more information, see What is Nitro Enclaves? in the AWS Nitro Enclaves User Guide .
You can't enable AWS Nitro Enclaves and hibernation on the same instance.
Type union: either IResolvable or CfnLaunchTemplate.IEnclaveOptionsProperty
HibernationOptions
Indicates whether an instance is enabled for hibernation.
object? HibernationOptions { get; }
Property Value
Remarks
This parameter is valid only if the instance meets the hibernation prerequisites . For more information, see Hibernate your Amazon EC2 instance in the Amazon EC2 User Guide .
Type union: either IResolvable or CfnLaunchTemplate.IHibernationOptionsProperty
IamInstanceProfile
The name or Amazon Resource Name (ARN) of an IAM instance profile.
object? IamInstanceProfile { get; }
Property Value
Remarks
ImageId
The ID of the AMI.
string? ImageId { get; }
Property Value
Remarks
Alternatively, you can specify a Systems Manager parameter, which will resolve to an AMI ID on launch.
Valid formats:
For more information, see Use a Systems Manager parameter to find an AMI in the Amazon Elastic Compute Cloud User Guide .
InstanceInitiatedShutdownBehavior
Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
string? InstanceInitiatedShutdownBehavior { get; }
Property Value
Remarks
InstanceMarketOptions
The market (purchasing) option for the instances.
object? InstanceMarketOptions { get; }
Property Value
Remarks
InstanceRequirements
The attributes for the instance types.
object? InstanceRequirements { get; }
Property Value
Remarks
When you specify instance attributes, Amazon EC2 will identify instance types with these attributes.
You must specify VCpuCount and MemoryMiB . All other attributes are optional. Any unspecified optional attribute is set to its default.
When you specify multiple attributes, you get instance types that satisfy all of the specified attributes. If you specify multiple values for an attribute, you get instance types that satisfy any of the specified values.
To limit the list of instance types from which Amazon EC2 can identify matching instance types, you can use one of the following parameters, but not both in the same request:
If you specify <code>InstanceRequirements</code> , you can't specify <code>InstanceType</code> .
Attribute-based instance type selection is only supported when using Auto Scaling groups, EC2 Fleet, and Spot Fleet to launch instances. If you plan to use the launch template in the launch instance wizard , or with the RunInstances API or AWS::EC2::Instance AWS CloudFormation resource, you can't specify InstanceRequirements .
For more information, see Specify attributes for instance type selection for EC2 Fleet or Spot Fleet and Spot placement score in the Amazon EC2 User Guide .
Type union: either IResolvable or CfnLaunchTemplate.IInstanceRequirementsProperty
InstanceType
The instance type. For more information, see Amazon EC2 instance types in the Amazon EC2 User Guide .
string? InstanceType { get; }
Property Value
Remarks
If you specify InstanceType , you can't specify InstanceRequirements .
KernelId
The ID of the kernel.
string? KernelId { get; }
Property Value
Remarks
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
The name of the key pair. You can create a key pair using CreateKeyPair or ImportKeyPair .
string? KeyName { get; }
Property Value
Remarks
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
The license configurations.
object? LicenseSpecifications { get; }
Property Value
Remarks
MaintenanceOptions
The maintenance options of your instance.
object? MaintenanceOptions { get; }
Property Value
Remarks
MetadataOptions
The metadata options for the instance.
object? MetadataOptions { get; }
Property Value
Remarks
For more information, see Configure the Instance Metadata Service options in the Amazon EC2 User Guide .
Type union: either IResolvable or CfnLaunchTemplate.IMetadataOptionsProperty
Monitoring
The monitoring for the instance.
object? Monitoring { get; }
Property Value
Remarks
NetworkInterfaces
The network interfaces for the instance.
object? NetworkInterfaces { get; }
Property Value
Remarks
NetworkPerformanceOptions
The settings for the network performance options for the instance.
object? NetworkPerformanceOptions { get; }
Property Value
Remarks
For more information, see EC2 instance bandwidth weighting configuration .
Type union: either IResolvable or CfnLaunchTemplate.INetworkPerformanceOptionsProperty
Placement
The placement for the instance.
object? Placement { get; }
Property Value
Remarks
PrivateDnsNameOptions
The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries should be handled.
object? PrivateDnsNameOptions { get; }
Property Value
Remarks
For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .
Type union: either IResolvable or CfnLaunchTemplate.IPrivateDnsNameOptionsProperty
RamDiskId
The ID of the RAM disk.
string? RamDiskId { get; }
Property Value
Remarks
We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">User provided kernels</a> in the <em>Amazon EC2 User Guide</em> .
SecurityGroupIds
The IDs of the security groups.
string[]? SecurityGroupIds { get; }
Property Value
string[]
Remarks
You can specify the IDs of existing security groups and references to resources created by the stack template.
If you specify a network interface, you must specify any security groups as part of the network interface instead.
SecurityGroups
The names of the security groups. For a nondefault VPC, you must use security group IDs instead.
string[]? SecurityGroups { get; }
Property Value
string[]
Remarks
If you specify a network interface, you must specify any security groups as part of the network interface instead of using this parameter.
TagSpecifications
The tags to apply to resources that are created during instance launch.
object? TagSpecifications { get; }
Property Value
Remarks
To tag the launch template itself, use TagSpecifications .
Type union: either IResolvable or (either IResolvable or CfnLaunchTemplate.ITagSpecificationProperty)[]
UserData
The user data to make available to the instance.
string? UserData { get; }
Property Value
Remarks
You must provide base64-encoded text. User data is limited to 16 KB. For more information, see Run commands when you launch an EC2 instance with user data input in the Amazon EC2 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 .