Interface InstanceProps
- All Superinterfaces:
software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
InstanceProps.Jsii$Proxy
Example:
Vpc vpc; InstanceType instanceType; IMachineImage machineImage; Instance.Builder.create(this, "Instance") .vpc(vpc) .instanceType(instanceType) .machineImage(machineImage) // ... .blockDevices(List.of(BlockDevice.builder() .deviceName("/dev/sda1") .volume(BlockDeviceVolume.ebs(50)) .build(), BlockDevice.builder() .deviceName("/dev/sdm") .volume(BlockDeviceVolume.ebs(100)) .build())) .build();
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
A builder forInstanceProps
static final class
An implementation forInstanceProps
-
Method Summary
Modifier and TypeMethodDescriptionstatic InstanceProps.Builder
builder()
default Boolean
Whether the instance could initiate connections to anywhere by default.default String
In which AZ to place the instance within the VPC.default List<BlockDevice>
Specifies how block devices are exposed to the instance.default Boolean
Whether "Detailed Monitoring" is enabled for this instance Keep in mind that Detailed Monitoring results in extra charges.default CloudFormationInit
getInit()
Apply the given CloudFormation Init configuration to the instance at startup.default ApplyCloudFormationInitOptions
Use the given options for applying CloudFormation Init.default String
The name of the instance.Type of instance to launch.default String
Name of SSH keypair to grant access to instance.AMI to launch.default String
Defines a private IP address to associate with an instance.default Boolean
Propagate the EC2 instance tags to the EBS volumes.default Boolean
Whether IMDSv2 should be required on this instance.default Duration
The length of time to wait for the resourceSignalCount.default IRole
getRole()
An IAM role to associate with the instance profile assigned to this Auto Scaling Group.default ISecurityGroup
Security Group to assign to this instance.default Boolean
Specifies whether to enable an instance launched in a VPC to perform NAT.default UserData
Specific UserData to use.default Boolean
Changes to the UserData force replacement.getVpc()
VPC to launch the instance in.default SubnetSelection
Where to place the instance within the VPC.Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getInstanceType
Type of instance to launch. -
getMachineImage
AMI to launch. -
getVpc
VPC to launch the instance in. -
getAllowAllOutbound
Whether the instance could initiate connections to anywhere by default.This property is only used when you do not provide a security group.
Default: true
-
getAvailabilityZone
In which AZ to place the instance within the VPC.Default: - Random zone.
-
getBlockDevices
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.
Default: - Uses the block device mapping of the AMI
- See Also:
-
getDetailedMonitoring
Whether "Detailed Monitoring" is enabled for this instance Keep in mind that Detailed Monitoring results in extra charges.Default: - false
- See Also:
-
getInit
Apply the given CloudFormation Init configuration to the instance at startup.Default: - no CloudFormation init
-
getInitOptions
Use the given options for applying CloudFormation Init.Describes the configsets to use and the timeout to wait
Default: - default options
-
getInstanceName
The name of the instance.Default: - CDK generated name
-
getKeyName
Name of SSH keypair to grant access to instance.Default: - No SSH access will be possible.
-
getPrivateIpAddress
Defines a private IP address to associate with an instance.Private IP should be available within the VPC that the instance is build within.
Default: - no association
-
getPropagateTagsToVolumeOnCreation
Propagate the EC2 instance tags to the EBS volumes.Default: - false
-
getRequireImdsv2
Whether IMDSv2 should be required on this instance.Default: - false
-
getResourceSignalTimeout
The length of time to wait for the resourceSignalCount.The maximum value is 43200 (12 hours).
Default: Duration.minutes(5)
-
getRole
An IAM role to associate with the instance profile assigned to this Auto Scaling Group.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();
-
getSecurityGroup
Security Group to assign to this instance.Default: - create new security group
-
getSourceDestCheck
Specifies whether to enable an instance launched in a VPC to perform NAT.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
-
getUserData
Specific UserData to use.The UserData may still be mutated after creation.
Default: - A UserData object appropriate for the MachineImage's Operating System is created.
-
getUserDataCausesReplacement
Changes to the UserData force replacement.Depending the EC2 instance type, changing UserData either restarts the instance or replaces the instance.
- Instance store-backed instances are replaced.
- EBS-backed instances are restarted.
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.
-
getVpcSubnets
Where to place the instance within the VPC.Default: - Private subnets.
-
builder
- Returns:
- a
InstanceProps.Builder
ofInstanceProps
-