Modifier and Type | Method and Description |
---|---|
Instance.Builder |
allowAllOutbound(java.lang.Boolean allowAllOutbound)
Whether the instance could initiate connections to anywhere by default.
|
Instance.Builder |
availabilityZone(java.lang.String availabilityZone)
In which AZ to place the instance within the VPC.
|
Instance.Builder |
blockDevices(java.util.List<? extends BlockDevice> blockDevices)
Specifies how block devices are exposed to the instance.
|
Instance |
build() |
static Instance.Builder |
create(software.constructs.Construct scope,
java.lang.String id) |
Instance.Builder |
detailedMonitoring(java.lang.Boolean detailedMonitoring)
Whether "Detailed Monitoring" is enabled for this instance Keep in mind that Detailed Monitoring results in extra charges.
|
Instance.Builder |
init(CloudFormationInit init)
Apply the given CloudFormation Init configuration to the instance at startup.
|
Instance.Builder |
initOptions(ApplyCloudFormationInitOptions initOptions)
Use the given options for applying CloudFormation Init.
|
Instance.Builder |
instanceName(java.lang.String instanceName)
The name of the instance.
|
Instance.Builder |
instanceType(InstanceType instanceType)
Type of instance to launch.
|
Instance.Builder |
keyName(java.lang.String keyName)
Name of SSH keypair to grant access to instance.
|
Instance.Builder |
machineImage(IMachineImage machineImage)
AMI to launch.
|
Instance.Builder |
privateIpAddress(java.lang.String privateIpAddress)
Defines a private IP address to associate with an instance.
|
Instance.Builder |
propagateTagsToVolumeOnCreation(java.lang.Boolean propagateTagsToVolumeOnCreation)
Propagate the EC2 instance tags to the EBS volumes.
|
Instance.Builder |
requireImdsv2(java.lang.Boolean requireImdsv2)
Whether IMDSv2 should be required on this instance.
|
Instance.Builder |
resourceSignalTimeout(Duration resourceSignalTimeout)
The length of time to wait for the resourceSignalCount.
|
Instance.Builder |
role(IRole role)
An IAM role to associate with the instance profile assigned to this Auto Scaling Group.
|
Instance.Builder |
securityGroup(ISecurityGroup securityGroup)
Security Group to assign to this instance.
|
Instance.Builder |
sourceDestCheck(java.lang.Boolean sourceDestCheck)
Specifies whether to enable an instance launched in a VPC to perform NAT.
|
Instance.Builder |
userData(UserData userData)
Specific UserData to use.
|
Instance.Builder |
userDataCausesReplacement(java.lang.Boolean userDataCausesReplacement)
Changes to the UserData force replacement.
|
Instance.Builder |
vpc(IVpc vpc)
VPC to launch the instance in.
|
Instance.Builder |
vpcSubnets(SubnetSelection vpcSubnets)
Where to place the instance within the VPC.
|
public static Instance.Builder create(software.constructs.Construct scope, java.lang.String id)
scope
- This parameter is required.id
- This parameter is required.Instance.Builder
.public Instance.Builder instanceType(InstanceType instanceType)
instanceType
- Type of instance to launch. This parameter is required.this
public Instance.Builder machineImage(IMachineImage machineImage)
machineImage
- AMI to launch. This parameter is required.this
public Instance.Builder vpc(IVpc vpc)
vpc
- VPC to launch the instance in. This parameter is required.this
public Instance.Builder allowAllOutbound(java.lang.Boolean allowAllOutbound)
This property is only used when you do not provide a security group.
Default: true
allowAllOutbound
- Whether the instance could initiate connections to anywhere by default. This parameter is required.this
public Instance.Builder availabilityZone(java.lang.String availabilityZone)
Default: - Random zone.
availabilityZone
- In which AZ to place the instance within the VPC. This parameter is required.this
public Instance.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 Instance.Builder detailedMonitoring(java.lang.Boolean detailedMonitoring)
Default: - false
detailedMonitoring
- Whether "Detailed Monitoring" is enabled for this instance Keep in mind that Detailed Monitoring results in extra charges. This parameter is required.this
public Instance.Builder init(CloudFormationInit init)
Default: - no CloudFormation init
init
- Apply the given CloudFormation Init configuration to the instance at startup. This parameter is required.this
public Instance.Builder initOptions(ApplyCloudFormationInitOptions initOptions)
Describes the configsets to use and the timeout to wait
Default: - default options
initOptions
- Use the given options for applying CloudFormation Init. This parameter is required.this
public Instance.Builder instanceName(java.lang.String instanceName)
Default: - CDK generated name
instanceName
- The name of the instance. This parameter is required.this
public Instance.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 Instance.Builder privateIpAddress(java.lang.String privateIpAddress)
Private IP should be available within the VPC that the instance is build within.
Default: - no association
privateIpAddress
- Defines a private IP address to associate with an instance. This parameter is required.this
public Instance.Builder propagateTagsToVolumeOnCreation(java.lang.Boolean propagateTagsToVolumeOnCreation)
Default: - false
propagateTagsToVolumeOnCreation
- Propagate the EC2 instance tags to the EBS volumes. This parameter is required.this
public Instance.Builder requireImdsv2(java.lang.Boolean requireImdsv2)
Default: - false
requireImdsv2
- Whether IMDSv2 should be required on this instance. This parameter is required.this
public Instance.Builder resourceSignalTimeout(Duration resourceSignalTimeout)
The maximum value is 43200 (12 hours).
Default: Duration.minutes(5)
resourceSignalTimeout
- The length of time to wait for the resourceSignalCount. This parameter is required.this
public Instance.Builder role(IRole role)
The role must be assumable by the service principal ec2.amazonaws.com
:
Default: - A role will automatically be created, it can be accessed via the `role` property
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 assigned to this Auto Scaling Group. This parameter is required.this
public Instance.Builder securityGroup(ISecurityGroup securityGroup)
Default: - create new security group
securityGroup
- Security Group to assign to this instance. This parameter is required.this
public Instance.Builder sourceDestCheck(java.lang.Boolean sourceDestCheck)
This controls whether source/destination checking is enabled on the instance. A value of true means that checking is enabled, and false means that checking is disabled. The value must be false for the instance to perform NAT.
Default: true
sourceDestCheck
- Specifies whether to enable an instance launched in a VPC to perform NAT. This parameter is required.this
public Instance.Builder userData(UserData userData)
The UserData may still be mutated after creation.
Default: - A UserData object appropriate for the MachineImage's Operating System is created.
userData
- Specific UserData to use. This parameter is required.this
public Instance.Builder userDataCausesReplacement(java.lang.Boolean userDataCausesReplacement)
Depending the EC2 instance type, changing UserData either restarts the instance or replaces the instance.
By default, restarting does not execute the new UserData so you will need a different mechanism to ensure the instance is restarted.
Setting this to true
will make the instance's Logical ID depend on the
UserData, which will cause CloudFormation to replace it if the UserData
changes.
Default: - true iff `initOptions` is specified, false otherwise.
userDataCausesReplacement
- Changes to the UserData force replacement. This parameter is required.this
public Instance.Builder vpcSubnets(SubnetSelection vpcSubnets)
Default: - Private subnets.
vpcSubnets
- Where to place the instance within the VPC. This parameter is required.this
public Instance build()