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
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forInstancePropsstatic final classAn implementation forInstanceProps -
Method Summary
Modifier and TypeMethodDescriptionstatic InstanceProps.Builderbuilder()default BooleanWhether the instance could initiate connections to anywhere by default.default StringIn which AZ to place the instance within the VPC.default List<BlockDevice>Specifies how block devices are exposed to the instance.default BooleanWhether "Detailed Monitoring" is enabled for this instance Keep in mind that Detailed Monitoring results in extra charges.default CloudFormationInitgetInit()Apply the given CloudFormation Init configuration to the instance at startup.default ApplyCloudFormationInitOptionsUse the given options for applying CloudFormation Init.default StringThe name of the instance.Type of instance to launch.default StringName of SSH keypair to grant access to instance.AMI to launch.default StringDefines a private IP address to associate with an instance.default BooleanPropagate the EC2 instance tags to the EBS volumes.default BooleanWhether IMDSv2 should be required on this instance.default DurationThe length of time to wait for the resourceSignalCount.default IRolegetRole()An IAM role to associate with the instance profile assigned to this Auto Scaling Group.default ISecurityGroupSecurity Group to assign to this instance.default BooleanSpecifies whether to enable an instance launched in a VPC to perform NAT.default UserDataSpecific UserData to use.default BooleanChanges to the UserData force replacement.getVpc()VPC to launch the instance in.default SubnetSelectionWhere 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
-
getDetailedMonitoring
Whether "Detailed Monitoring" is enabled for this instance Keep in mind that Detailed Monitoring results in extra charges.Default: - false
-
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
truewill 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.BuilderofInstanceProps
-