@Generated(value="jsii-pacmak/1.50.0 (build d1830a4)", date="2022-01-04T15:39:06.977Z") @Stability(value=Experimental) public interface AddCapacityOptions extends software.amazon.jsii.JsiiSerializable, AddAutoScalingGroupCapacityOptions, CommonAutoScalingGroupProps
Example:
Vpc vpc;
Cluster cluster = Cluster.Builder.create(this, "Cluster")
.vpc(vpc)
.build();
// Either add default capacity
cluster.addCapacity("DefaultAutoScalingGroupCapacity", AddCapacityOptions.builder()
.instanceType(new InstanceType("t2.xlarge"))
.desiredCapacity(3)
.build());
// Or add customized capacity. Be sure to start the Amazon ECS-optimized AMI.
AutoScalingGroup autoScalingGroup = AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(new InstanceType("t2.xlarge"))
.machineImage(EcsOptimizedImage.amazonLinux())
// Or use Amazon ECS-Optimized Amazon Linux 2 AMI
// machineImage: EcsOptimizedImage.amazonLinux2(),
.desiredCapacity(3)
.build();
cluster.addAutoScalingGroup(autoScalingGroup);
| Modifier and Type | Interface and Description |
|---|---|
static class |
AddCapacityOptions.Builder
A builder for
AddCapacityOptions |
static class |
AddCapacityOptions.Jsii$Proxy
An implementation for
AddCapacityOptions |
| Modifier and Type | Method and Description |
|---|---|
static AddCapacityOptions.Builder |
builder() |
InstanceType |
getInstanceType()
(experimental) The EC2 instance type to use when launching instances into the AutoScalingGroup.
|
default IMachineImage |
getMachineImage()
(experimental) The ECS-optimized AMI variant to use.
|
getCanContainersAccessInstanceRole, getMachineImageType, getSpotInstanceDraining, getTaskDrainTime, getTopicEncryptionKeygetAllowAllOutbound, getAssociatePublicIpAddress, getAutoScalingGroupName, getBlockDevices, getCooldown, getDesiredCapacity, getGroupMetrics, getHealthCheck, getIgnoreUnmodifiedSizeProperties, getInstanceMonitoring, getKeyName, getMaxCapacity, getMaxInstanceLifetime, getMinCapacity, getNewInstancesProtectedFromScaleIn, getNotifications, getNotificationsTopic, getReplacingUpdateMinSuccessfulInstancesPercent, getResourceSignalCount, getResourceSignalTimeout, getRollingUpdateConfiguration, getSignals, getSpotPrice, getTerminationPolicies, getUpdatePolicy, getUpdateType, getVpcSubnets@Stability(value=Experimental) @NotNull InstanceType getInstanceType()
@Stability(value=Experimental) @Nullable default IMachineImage getMachineImage()
The default is to use an ECS-optimized AMI of Amazon Linux 2 which is automatically updated to the latest version on every deployment. This will replace the instances in the AutoScalingGroup. Make sure you have not disabled task draining, to avoid downtime when the AMI updates.
To use an image that does not update on every deployment, pass:
EcsOptimizedImage machineImage = EcsOptimizedImage.amazonLinux2(AmiHardwareType.STANDARD, EcsOptimizedImageOptions.builder()
.cachedInContext(true)
.build());
For more information, see Amazon ECS-optimized AMIs.
You must define either machineImage or machineImageType, not both.
Default: - Automatically updated, ECS-optimized Amazon Linux 2
@Stability(value=Experimental) static AddCapacityOptions.Builder builder()
builder in interface AddAutoScalingGroupCapacityOptionsbuilder in interface CommonAutoScalingGroupPropsAddCapacityOptions.Builder of AddCapacityOptionsCopyright © 2022. All rights reserved.