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 ILaunchTemplateDataProperty
Syntax (vb)
Public Interface 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,
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
},
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,
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"
} },
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 | If you set this parameter to |
EbsOptimized | Indicates whether the instance is optimized for Amazon EBS I/O. |
ElasticGpuSpecifications | Deprecated. |
ElasticInferenceAccelerators | An elastic inference accelerator to associate with the instance. |
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 Instance types in the Amazon Elastic Compute Cloud 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. |
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 the resources that are created during instance launch. |
UserData | The user data to make available to the instance. |
Properties
BlockDeviceMappings
The block device mapping.
virtual object BlockDeviceMappings { get; }
Property Value
System.Object
Remarks
CapacityReservationSpecification
The Capacity Reservation targeting option.
virtual object CapacityReservationSpecification { get; }
Property Value
System.Object
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).
CpuOptions
The CPU options for the instance.
virtual object CpuOptions { get; }
Property Value
System.Object
Remarks
For more information, see Optimizing CPU Options in the Amazon Elastic Compute Cloud User Guide .
CreditSpecification
The credit option for CPU usage of the instance.
virtual object CreditSpecification { get; }
Property Value
System.Object
Remarks
DisableApiStop
Indicates whether to enable the instance for stop protection.
virtual object DisableApiStop { get; }
Property Value
System.Object
Remarks
For more information, see Stop protection in the Amazon Elastic Compute Cloud User Guide .
DisableApiTermination
If you set this parameter to true
, you can't terminate the instance using the Amazon EC2 console, CLI, or API;
virtual object DisableApiTermination { get; }
Property Value
System.Object
Remarks
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
Indicates whether the instance is optimized for Amazon EBS I/O.
virtual object EbsOptimized { get; }
Property Value
System.Object
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.
ElasticGpuSpecifications
Deprecated.
virtual object ElasticGpuSpecifications { get; }
Property Value
System.Object
Remarks
Amazon Elastic Graphics reached end of life on January 8, 2024. For workloads that require graphics acceleration, we recommend that you use Amazon EC2 G4ad, G4dn, or G5 instances.
ElasticInferenceAccelerators
An elastic inference accelerator to associate with the instance.
virtual object ElasticInferenceAccelerators { get; }
Property Value
System.Object
Remarks
Elastic inference accelerators are a resource you can attach to your Amazon EC2 instances to accelerate your Deep Learning (DL) inference workloads.
You cannot specify accelerators from different generations in the same request.
Starting April 15, 2023, AWS will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS, or Amazon EC2. However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service.
EnclaveOptions
Indicates whether the instance is enabled for AWS Nitro Enclaves.
virtual object EnclaveOptions { get; }
Property Value
System.Object
Remarks
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
Indicates whether an instance is enabled for hibernation.
virtual object HibernationOptions { get; }
Property Value
System.Object
Remarks
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
The name or Amazon Resource Name (ARN) of an IAM instance profile.
virtual object IamInstanceProfile { get; }
Property Value
System.Object
Remarks
ImageId
The ID of the AMI.
virtual string ImageId { get; }
Property Value
System.String
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).
virtual string InstanceInitiatedShutdownBehavior { get; }
Property Value
System.String
Remarks
InstanceMarketOptions
The market (purchasing) option for the instances.
virtual object InstanceMarketOptions { get; }
Property Value
System.Object
Remarks
InstanceRequirements
The attributes for the instance types.
virtual object InstanceRequirements { get; }
Property Value
System.Object
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 Attribute-based instance type selection for EC2 Fleet , Attribute-based instance type selection for Spot Fleet , and Spot placement score in the Amazon EC2 User Guide .
InstanceType
The instance type. For more information, see Instance types in the Amazon Elastic Compute Cloud User Guide .
virtual string InstanceType { get; }
Property Value
System.String
Remarks
If you specify InstanceType
, you can't specify InstanceRequirements
.
KernelId
The ID of the kernel.
virtual string KernelId { get; }
Property Value
System.String
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 .
virtual string KeyName { get; }
Property Value
System.String
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.
virtual object LicenseSpecifications { get; }
Property Value
System.Object
Remarks
MaintenanceOptions
The maintenance options of your instance.
virtual object MaintenanceOptions { get; }
Property Value
System.Object
Remarks
MetadataOptions
The metadata options for the instance.
virtual object MetadataOptions { get; }
Property Value
System.Object
Remarks
For more information, see Instance metadata and user data in the Amazon Elastic Compute Cloud User Guide .
Monitoring
The monitoring for the instance.
virtual object Monitoring { get; }
Property Value
System.Object
Remarks
NetworkInterfaces
The network interfaces for the instance.
virtual object NetworkInterfaces { get; }
Property Value
System.Object
Remarks
Placement
The placement for the instance.
virtual object Placement { get; }
Property Value
System.Object
Remarks
PrivateDnsNameOptions
The hostname type for EC2 instances launched into this subnet and how DNS A and AAAA record queries should be handled.
virtual object PrivateDnsNameOptions { get; }
Property Value
System.Object
Remarks
For more information, see Amazon EC2 instance hostname types in the Amazon Elastic Compute Cloud User Guide .
RamDiskId
The ID of the RAM disk.
virtual string RamDiskId { get; }
Property Value
System.String
Remarks
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
The IDs of the security groups.
virtual string[] SecurityGroupIds { get; }
Property Value
System.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.
virtual string[] SecurityGroups { get; }
Property Value
System.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 the resources that are created during instance launch.
virtual object TagSpecifications { get; }
Property Value
System.Object
Remarks
To tag a resource after it has been created, see CreateTags .
To tag the launch template itself, use TagSpecifications .
UserData
The user data to make available to the instance.
virtual string UserData { get; }
Property Value
System.String
Remarks
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 .