@Generated(value="jsii-pacmak/1.67.0 (build 2c027f5)", date="2022-09-19T20:26:38.566Z") @Stability(value=Stable) public interface AddCapacityOptions extends software.amazon.jsii.JsiiSerializable, AddAutoScalingGroupCapacityOptions, CommonAutoScalingGroupProps
Example:
Vpc vpc;
// Create an ECS cluster
Cluster cluster = Cluster.Builder.create(this, "Cluster")
.vpc(vpc)
.build();
// Add capacity to it
cluster.addCapacity("DefaultAutoScalingGroupCapacity", AddCapacityOptions.builder()
.instanceType(new InstanceType("t2.xlarge"))
.desiredCapacity(3)
.build());
Ec2TaskDefinition taskDefinition = new Ec2TaskDefinition(this, "TaskDef");
taskDefinition.addContainer("DefaultContainer", ContainerDefinitionOptions.builder()
.image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
.memoryLimitMiB(512)
.build());
// Instantiate an Amazon ECS Service
Ec2Service ecsService = Ec2Service.Builder.create(this, "Service")
.cluster(cluster)
.taskDefinition(taskDefinition)
.build();
| 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()
The EC2 instance type to use when launching instances into the AutoScalingGroup.
|
default IMachineImage |
getMachineImage()
The ECS-optimized AMI variant to use.
|
getCanContainersAccessInstanceRole, getMachineImageType, getSpotInstanceDraining, getTopicEncryptionKeygetAllowAllOutbound, getAssociatePublicIpAddress, getAutoScalingGroupName, getBlockDevices, getCooldown, getDesiredCapacity, getGroupMetrics, getHealthCheck, getIgnoreUnmodifiedSizeProperties, getInstanceMonitoring, getKeyName, getMaxCapacity, getMaxInstanceLifetime, getMinCapacity, getNewInstancesProtectedFromScaleIn, getNotifications, getSignals, getSpotPrice, getTerminationPolicies, getUpdatePolicy, getVpcSubnets@Stability(value=Stable) @NotNull InstanceType getInstanceType()
@Stability(value=Stable) @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=Stable) static AddCapacityOptions.Builder builder()
builder in interface AddAutoScalingGroupCapacityOptionsbuilder in interface CommonAutoScalingGroupPropsAddCapacityOptions.Builder of AddCapacityOptionsCopyright © 2022. All rights reserved.