@Generated(value="jsii-pacmak/1.60.0 (build ebcefe6)", date="2022-06-22T23:28:01.254Z") public interface AsgCapacityProviderProps extends 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()
The autoscaling group to add as a Capacity Provider.
|
default java.lang.String |
getCapacityProviderName()
The name of the capacity provider.
|
default java.lang.Boolean |
getEnableManagedScaling()
Whether to enable managed scaling.
|
default java.lang.Boolean |
getEnableManagedTerminationProtection()
Whether to enable managed termination protection.
|
default java.lang.Number |
getMaximumScalingStepSize()
Maximum scaling step size.
|
default java.lang.Number |
getMinimumScalingStepSize()
Minimum scaling step size.
|
default java.lang.Number |
getTargetCapacityPercent()
Target capacity percent.
|
getCanContainersAccessInstanceRole, getMachineImageType, getSpotInstanceDraining, getTaskDrainTime, getTopicEncryptionKey
IAutoScalingGroup getAutoScalingGroup()
default java.lang.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
default java.lang.Boolean getEnableManagedScaling()
Default: true
default java.lang.Boolean getEnableManagedTerminationProtection()
Default: true
default java.lang.Number getMaximumScalingStepSize()
In most cases this should be left alone.
Default: 1000
default java.lang.Number getMinimumScalingStepSize()
In most cases this should be left alone.
Default: 1
default java.lang.Number getTargetCapacityPercent()
In most cases this should be left alone.
Default: 100
static AsgCapacityProviderProps.Builder builder()
builder
in interface AddAutoScalingGroupCapacityOptions
AsgCapacityProviderProps.Builder
of AsgCapacityProviderProps