Interface AsgCapacityProviderProps
- All Superinterfaces:
AddAutoScalingGroupCapacityOptions
,software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
AsgCapacityProviderProps.Jsii$Proxy
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:46.980Z")
@Stability(Stable)
public interface AsgCapacityProviderProps
extends software.amazon.jsii.JsiiSerializable, AddAutoScalingGroupCapacityOptions
The options for creating an Auto Scaling Group Capacity Provider.
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();
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic final class
A builder forAsgCapacityProviderProps
static final class
An implementation forAsgCapacityProviderProps
-
Method Summary
Modifier and TypeMethodDescriptionbuilder()
The autoscaling group to add as a Capacity Provider.default String
The name of the capacity provider.default Boolean
Whether to enable managed scaling.default Boolean
Whether to enable managed termination protection.default Number
Maximum scaling step size.default Number
Minimum scaling step size.default Number
Target capacity percent.Methods inherited from interface software.amazon.awscdk.services.ecs.AddAutoScalingGroupCapacityOptions
getCanContainersAccessInstanceRole, getMachineImageType, getSpotInstanceDraining, getTaskDrainTime, getTopicEncryptionKey
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getAutoScalingGroup
The autoscaling group to add as a Capacity Provider. -
getCapacityProviderName
The name of the capacity provider.If a name is specified, it cannot start with
aws
,ecs
, orfargate
. If no name is specified, a default name in the CFNStackName-CFNResourceName-RandomString format is used.Default: CloudFormation-generated name
-
getEnableManagedScaling
Whether to enable managed scaling.Default: true
-
getEnableManagedTerminationProtection
Whether to enable managed termination protection.Default: true
-
getMaximumScalingStepSize
Maximum scaling step size.In most cases this should be left alone.
Default: 1000
-
getMinimumScalingStepSize
Minimum scaling step size.In most cases this should be left alone.
Default: 1
-
getTargetCapacityPercent
Target capacity percent.In most cases this should be left alone.
Default: 100
-
builder
- Returns:
- a
AsgCapacityProviderProps.Builder
ofAsgCapacityProviderProps
-