Class LaunchTemplateProps.Builder
java.lang.Object
software.amazon.awscdk.services.ec2.LaunchTemplateProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<LaunchTemplateProps>
- Enclosing interface:
LaunchTemplateProps
@Stability(Stable)
public static final class LaunchTemplateProps.Builder
extends Object
implements software.amazon.jsii.Builder<LaunchTemplateProps>
A builder for
LaunchTemplateProps
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionblockDevices
(List<? extends BlockDevice> blockDevices) Sets the value ofLaunchTemplateProps.getBlockDevices()
build()
Builds the configured instance.cpuCredits
(CpuCredits cpuCredits) Sets the value ofLaunchTemplateProps.getCpuCredits()
detailedMonitoring
(Boolean detailedMonitoring) Sets the value ofLaunchTemplateProps.getDetailedMonitoring()
disableApiTermination
(Boolean disableApiTermination) Sets the value ofLaunchTemplateProps.getDisableApiTermination()
ebsOptimized
(Boolean ebsOptimized) Sets the value ofLaunchTemplateProps.getEbsOptimized()
hibernationConfigured
(Boolean hibernationConfigured) Sets the value ofLaunchTemplateProps.getHibernationConfigured()
instanceInitiatedShutdownBehavior
(InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior) Sets the value ofLaunchTemplateProps.getInstanceInitiatedShutdownBehavior()
instanceType
(InstanceType instanceType) Sets the value ofLaunchTemplateProps.getInstanceType()
Sets the value ofLaunchTemplateProps.getKeyName()
launchTemplateName
(String launchTemplateName) Sets the value ofLaunchTemplateProps.getLaunchTemplateName()
machineImage
(IMachineImage machineImage) Sets the value ofLaunchTemplateProps.getMachineImage()
nitroEnclaveEnabled
(Boolean nitroEnclaveEnabled) Sets the value ofLaunchTemplateProps.getNitroEnclaveEnabled()
requireImdsv2
(Boolean requireImdsv2) Sets the value ofLaunchTemplateProps.getRequireImdsv2()
Sets the value ofLaunchTemplateProps.getRole()
securityGroup
(ISecurityGroup securityGroup) Sets the value ofLaunchTemplateProps.getSecurityGroup()
spotOptions
(LaunchTemplateSpotOptions spotOptions) Sets the value ofLaunchTemplateProps.getSpotOptions()
Sets the value ofLaunchTemplateProps.getUserData()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
blockDevices
@Stability(Stable) public LaunchTemplateProps.Builder blockDevices(List<? extends BlockDevice> blockDevices) Sets the value ofLaunchTemplateProps.getBlockDevices()
- Parameters:
blockDevices
- Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. 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.- Returns:
this
-
cpuCredits
Sets the value ofLaunchTemplateProps.getCpuCredits()
- Parameters:
cpuCredits
- CPU credit type for burstable EC2 instance types.- Returns:
this
-
detailedMonitoring
@Stability(Stable) public LaunchTemplateProps.Builder detailedMonitoring(Boolean detailedMonitoring) Sets the value ofLaunchTemplateProps.getDetailedMonitoring()
- Parameters:
detailedMonitoring
- If set to true, then detailed monitoring will be enabled on instances created with this launch template.- Returns:
this
-
disableApiTermination
@Stability(Stable) public LaunchTemplateProps.Builder disableApiTermination(Boolean disableApiTermination) Sets the value ofLaunchTemplateProps.getDisableApiTermination()
- Parameters:
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;. otherwise, you can.- Returns:
this
-
ebsOptimized
Sets the value ofLaunchTemplateProps.getEbsOptimized()
- Parameters:
ebsOptimized
- Indicates whether the instances are 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.- Returns:
this
-
hibernationConfigured
@Stability(Stable) public LaunchTemplateProps.Builder hibernationConfigured(Boolean hibernationConfigured) Sets the value ofLaunchTemplateProps.getHibernationConfigured()
- Parameters:
hibernationConfigured
- If you set this parameter to true, the instance is enabled for hibernation.- Returns:
this
-
instanceInitiatedShutdownBehavior
@Stability(Stable) public LaunchTemplateProps.Builder instanceInitiatedShutdownBehavior(InstanceInitiatedShutdownBehavior instanceInitiatedShutdownBehavior) Sets the value ofLaunchTemplateProps.getInstanceInitiatedShutdownBehavior()
- Parameters:
instanceInitiatedShutdownBehavior
- Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).- Returns:
this
-
instanceType
Sets the value ofLaunchTemplateProps.getInstanceType()
- Parameters:
instanceType
- Type of instance to launch.- Returns:
this
-
keyName
Sets the value ofLaunchTemplateProps.getKeyName()
- Parameters:
keyName
- Name of SSH keypair to grant access to instance.- Returns:
this
-
launchTemplateName
Sets the value ofLaunchTemplateProps.getLaunchTemplateName()
- Parameters:
launchTemplateName
- Name for this launch template.- Returns:
this
-
machineImage
Sets the value ofLaunchTemplateProps.getMachineImage()
- Parameters:
machineImage
- The AMI that will be used by instances.- Returns:
this
-
nitroEnclaveEnabled
@Stability(Stable) public LaunchTemplateProps.Builder nitroEnclaveEnabled(Boolean nitroEnclaveEnabled) Sets the value ofLaunchTemplateProps.getNitroEnclaveEnabled()
- Parameters:
nitroEnclaveEnabled
- If this parameter is set to true, the instance is enabled for AWS Nitro Enclaves;. otherwise, it is not enabled for AWS Nitro Enclaves.- Returns:
this
-
requireImdsv2
Sets the value ofLaunchTemplateProps.getRequireImdsv2()
- Parameters:
requireImdsv2
- Whether IMDSv2 should be required on launched instances.- Returns:
this
-
role
Sets the value ofLaunchTemplateProps.getRole()
- Parameters:
role
- An IAM role to associate with the instance profile that is used by instances. The role must be assumable by the service principalec2.amazonaws.com
:- Returns:
this
-
securityGroup
Sets the value ofLaunchTemplateProps.getSecurityGroup()
- Parameters:
securityGroup
- Security group to assign to instances created with the launch template.- Returns:
this
-
spotOptions
@Stability(Stable) public LaunchTemplateProps.Builder spotOptions(LaunchTemplateSpotOptions spotOptions) Sets the value ofLaunchTemplateProps.getSpotOptions()
- Parameters:
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.- Returns:
this
-
userData
Sets the value ofLaunchTemplateProps.getUserData()
- Parameters:
userData
- The AMI that will be used by instances.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<LaunchTemplateProps>
- Returns:
- a new instance of
LaunchTemplateProps
- Throws:
NullPointerException
- if any required attribute was not provided
-