@Generated(value="jsii-pacmak/1.50.0 (build d1830a4)", date="2022-01-04T15:39:06.992Z") @Stability(value=Experimental) public interface AsgCapacityProviderProps extends software.amazon.jsii.JsiiSerializable, AddAutoScalingGroupCapacityOptions
Example:
Vpc vpc;
Cluster cluster = Cluster.Builder.create(this, "Cluster")
.vpc(vpc)
.build();
AutoScalingGroup autoScalingGroup = AutoScalingGroup.Builder.create(this, "ASG")
.vpc(vpc)
.instanceType(new InstanceType("t2.micro"))
.machineImage(EcsOptimizedImage.amazonLinux2())
.minCapacity(0)
.maxCapacity(100)
.build();
AsgCapacityProvider capacityProvider = AsgCapacityProvider.Builder.create(this, "AsgCapacityProvider")
.autoScalingGroup(autoScalingGroup)
.build();
cluster.addAsgCapacityProvider(capacityProvider);
Ec2TaskDefinition taskDefinition = new Ec2TaskDefinition(this, "TaskDef");
taskDefinition.addContainer("web", ContainerDefinitionOptions.builder()
.image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
.memoryReservationMiB(256)
.build());
Ec2Service.Builder.create(this, "EC2Service")
.cluster(cluster)
.taskDefinition(taskDefinition)
.capacityProviderStrategies(List.of(CapacityProviderStrategy.builder()
.capacityProvider(capacityProvider.getCapacityProviderName())
.weight(1)
.build()))
.build();
| Modifier and Type | Interface and Description |
|---|---|
static class |
AsgCapacityProviderProps.Builder
A builder for
AsgCapacityProviderProps |
static class |
AsgCapacityProviderProps.Jsii$Proxy
An implementation for
AsgCapacityProviderProps |
| Modifier and Type | Method and Description |
|---|---|
static AsgCapacityProviderProps.Builder |
builder() |
IAutoScalingGroup |
getAutoScalingGroup()
(experimental) The autoscaling group to add as a Capacity Provider.
|
default String |
getCapacityProviderName()
(experimental) The name of the capacity provider.
|
default Boolean |
getEnableManagedScaling()
(experimental) Whether to enable managed scaling.
|
default Boolean |
getEnableManagedTerminationProtection()
(experimental) Whether to enable managed termination protection.
|
default Number |
getMaximumScalingStepSize()
(experimental) Maximum scaling step size.
|
default Number |
getMinimumScalingStepSize()
(experimental) Minimum scaling step size.
|
default Number |
getTargetCapacityPercent()
(experimental) Target capacity percent.
|
getCanContainersAccessInstanceRole, getMachineImageType, getSpotInstanceDraining, getTaskDrainTime, getTopicEncryptionKey@Stability(value=Experimental) @NotNull IAutoScalingGroup getAutoScalingGroup()
@Stability(value=Experimental) @Nullable default String getCapacityProviderName()
If a name is specified,
it cannot start with aws, ecs, or fargate. If no name is specified,
a default name in the CFNStackName-CFNResourceName-RandomString format is used.
Default: CloudFormation-generated name
@Stability(value=Experimental) @Nullable default Boolean getEnableManagedScaling()
Default: true
@Stability(value=Experimental) @Nullable default Boolean getEnableManagedTerminationProtection()
Default: true
@Stability(value=Experimental) @Nullable default Number getMaximumScalingStepSize()
In most cases this should be left alone.
Default: 1000
@Stability(value=Experimental) @Nullable default Number getMinimumScalingStepSize()
In most cases this should be left alone.
Default: 1
@Stability(value=Experimental) @Nullable default Number getTargetCapacityPercent()
In most cases this should be left alone.
Default: 100
@Stability(value=Experimental) static AsgCapacityProviderProps.Builder builder()
builder in interface AddAutoScalingGroupCapacityOptionsAsgCapacityProviderProps.Builder of AsgCapacityProviderPropsCopyright © 2022. All rights reserved.