public static final class LaunchTemplate.Builder
extends java.lang.Object
LaunchTemplate
.Modifier and Type | Method and Description |
---|---|
LaunchTemplate.Builder |
blockDevices(java.util.List<? extends BlockDevice> blockDevices)
Specifies how block devices are exposed to the instance.
|
LaunchTemplate |
build() |
LaunchTemplate.Builder |
cpuCredits(CpuCredits cpuCredits)
CPU credit type for burstable EC2 instance types.
|
static LaunchTemplate.Builder |
create(software.constructs.Construct scope,
java.lang.String id) |
LaunchTemplate.Builder |
detailedMonitoring(java.lang.Boolean detailedMonitoring)
If set to true, then detailed monitoring will be enabled on instances created with this launch template.
|
LaunchTemplate.Builder |
disableApiTermination(java.lang.Boolean disableApiTermination)
If you set this parameter to true, you cannot terminate the instances launched with this launch template using the Amazon EC2 console, CLI, or API;
|
LaunchTemplate.Builder |
ebsOptimized(java.lang.Boolean ebsOptimized)
Indicates whether the instances are optimized for Amazon EBS I/O.
|
LaunchTemplate.Builder |
hibernationConfigured(java.lang.Boolean hibernationConfigured)
If you set this parameter to true, the instance is enabled for hibernation.
|
LaunchTemplate.Builder |
instanceInitiatedShutdownBehavior(InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior)
Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).
|
LaunchTemplate.Builder |
instanceType(InstanceType instanceType)
Type of instance to launch.
|
LaunchTemplate.Builder |
keyName(java.lang.String keyName)
Name of SSH keypair to grant access to instance.
|
LaunchTemplate.Builder |
launchTemplateName(java.lang.String launchTemplateName)
Name for this launch template.
|
LaunchTemplate.Builder |
machineImage(IMachineImage machineImage)
The AMI that will be used by instances.
|
LaunchTemplate.Builder |
nitroEnclaveEnabled(java.lang.Boolean nitroEnclaveEnabled)
If this parameter is set to true, the instance is enabled for AWS Nitro Enclaves;
|
LaunchTemplate.Builder |
requireImdsv2(java.lang.Boolean requireImdsv2)
Whether IMDSv2 should be required on launched instances.
|
LaunchTemplate.Builder |
role(IRole role)
An IAM role to associate with the instance profile that is used by instances.
|
LaunchTemplate.Builder |
securityGroup(ISecurityGroup securityGroup)
Security group to assign to instances created with the launch template.
|
LaunchTemplate.Builder |
spotOptions(LaunchTemplateSpotOptions spotOptions)
If this property is defined, then the Launch Template's InstanceMarketOptions will be set to use Spot instances, and the options for the Spot instances will be as defined.
|
LaunchTemplate.Builder |
userData(UserData userData)
The AMI that will be used by instances.
|
public static LaunchTemplate.Builder create(software.constructs.Construct scope, java.lang.String id)
scope
- This parameter is required.id
- This parameter is required.LaunchTemplate.Builder
.public LaunchTemplate.Builder blockDevices(java.util.List<? extends BlockDevice> blockDevices)
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
blockDevices
- Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. This parameter is required.this
public LaunchTemplate.Builder cpuCredits(CpuCredits cpuCredits)
Default: - No credit type is specified in the Launch Template.
cpuCredits
- CPU credit type for burstable EC2 instance types. This parameter is required.this
public LaunchTemplate.Builder detailedMonitoring(java.lang.Boolean detailedMonitoring)
Default: False - Detailed monitoring is disabled.
detailedMonitoring
- If set to true, then detailed monitoring will be enabled on instances created with this launch template. This parameter is required.this
public LaunchTemplate.Builder disableApiTermination(java.lang.Boolean disableApiTermination)
otherwise, you can.
Default: - The API termination setting is not specified in the Launch Template.
disableApiTermination
- If you set this parameter to true, you cannot terminate the instances launched with this launch template using the Amazon EC2 console, CLI, or API;. This parameter is required.this
public LaunchTemplate.Builder ebsOptimized(java.lang.Boolean ebsOptimized)
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.
ebsOptimized
- Indicates whether the instances are optimized for Amazon EBS I/O. This parameter is required.this
public LaunchTemplate.Builder hibernationConfigured(java.lang.Boolean hibernationConfigured)
Default: - Hibernation configuration is not specified in the launch template; defaulting to false.
hibernationConfigured
- If you set this parameter to true, the instance is enabled for hibernation. This parameter is required.this
public LaunchTemplate.Builder instanceInitiatedShutdownBehavior(InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior)
Default: - Shutdown behavior is not specified in the launch template; defaults to STOP.
instanceInitiatedShutdownBehavior
- Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown). This parameter is required.this
public LaunchTemplate.Builder instanceType(InstanceType instanceType)
Default: - This Launch Template does not specify a default Instance Type.
instanceType
- Type of instance to launch. This parameter is required.this
public LaunchTemplate.Builder keyName(java.lang.String keyName)
Default: - No SSH access will be possible.
keyName
- Name of SSH keypair to grant access to instance. This parameter is required.this
public LaunchTemplate.Builder launchTemplateName(java.lang.String launchTemplateName)
Default: Automatically generated name
launchTemplateName
- Name for this launch template. This parameter is required.this
public LaunchTemplate.Builder machineImage(IMachineImage machineImage)
Default: - This Launch Template does not specify a default AMI.
machineImage
- The AMI that will be used by instances. This parameter is required.this
public LaunchTemplate.Builder nitroEnclaveEnabled(java.lang.Boolean nitroEnclaveEnabled)
otherwise, it is not enabled for AWS Nitro Enclaves.
Default: - Enablement of Nitro enclaves is not specified in the launch template; defaulting to false.
nitroEnclaveEnabled
- If this parameter is set to true, the instance is enabled for AWS Nitro Enclaves;. This parameter is required.this
public LaunchTemplate.Builder requireImdsv2(java.lang.Boolean requireImdsv2)
Default: - false
requireImdsv2
- Whether IMDSv2 should be required on launched instances. This parameter is required.this
public LaunchTemplate.Builder role(IRole role)
The role must be assumable by the service principal ec2.amazonaws.com
:
Default: - No new role is created.
Example:
Role role = Role.Builder.create(this, "MyRole") .assumedBy(new ServicePrincipal("ec2.amazonaws.com")) .build();
role
- An IAM role to associate with the instance profile that is used by instances. This parameter is required.this
public LaunchTemplate.Builder securityGroup(ISecurityGroup securityGroup)
Default: No security group is assigned.
securityGroup
- Security group to assign to instances created with the launch template. This parameter is required.this
public LaunchTemplate.Builder spotOptions(LaunchTemplateSpotOptions spotOptions)
Default: - Instance launched with this template will not be spot instances.
spotOptions
- If this property is defined, then the Launch Template's InstanceMarketOptions will be set to use Spot instances, and the options for the Spot instances will be as defined. This parameter is required.this
public LaunchTemplate.Builder userData(UserData userData)
Default: - This Launch Template creates a UserData based on the type of provided machineImage; no UserData is created if a machineImage is not provided
userData
- The AMI that will be used by instances. This parameter is required.this
public LaunchTemplate build()