Interface AsgCapacityProviderProps
- All Superinterfaces:
AddAutoScalingGroupCapacityOptions
,software.amazon.jsii.JsiiSerializable
- All Known Implementing Classes:
AsgCapacityProviderProps.Jsii$Proxy
Example:
Vpc vpc; LaunchTemplate launchTemplate = LaunchTemplate.Builder.create(this, "ASG-LaunchTemplate") .instanceType(new InstanceType("t3.medium")) .machineImage(EcsOptimizedImage.amazonLinux2()) .userData(UserData.forLinux()) .build(); AutoScalingGroup autoScalingGroup = AutoScalingGroup.Builder.create(this, "ASG") .vpc(vpc) .mixedInstancesPolicy(MixedInstancesPolicy.builder() .instancesDistribution(InstancesDistribution.builder() .onDemandPercentageAboveBaseCapacity(50) .build()) .launchTemplate(launchTemplate) .build()) .build(); Cluster cluster = Cluster.Builder.create(this, "Cluster").vpc(vpc).build(); AsgCapacityProvider capacityProvider = AsgCapacityProvider.Builder.create(this, "AsgCapacityProvider") .autoScalingGroup(autoScalingGroup) .machineImageType(MachineImageType.AMAZON_LINUX_2) .build(); cluster.addAsgCapacityProvider(capacityProvider);
-
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
Managed instance draining facilitates graceful termination of Amazon ECS instances.default Boolean
When enabled the scale-in and scale-out actions of the cluster's Auto Scaling Group will be managed for you.default Boolean
When enabled the Auto Scaling Group will only terminate EC2 instances that no longer have running non-daemon tasks.default Number
The period of time, in seconds, after a newly launched Amazon EC2 instance can contribute to CloudWatch metrics for Auto Scaling group.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, getTopicEncryptionKey
Methods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Method Details
-
getAutoScalingGroup
The autoscaling group to add as a Capacity Provider.Warning: When passing an imported resource using
AutoScalingGroup.fromAutoScalingGroupName
along withenableManagedTerminationProtection: true
, theAsgCapacityProvider
construct will not be able to enforce the optionnewInstancesProtectedFromScaleIn
of theAutoScalingGroup
. In this case the constructor ofAsgCapacityProvider
will throw an exception. -
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. If the stack name starts withaws
,ecs
, orfargate
, a unique resource name is generated that starts withcp-
.Default: CloudFormation-generated name
-
getEnableManagedDraining
Managed instance draining facilitates graceful termination of Amazon ECS instances.This allows your service workloads to stop safely and be rescheduled to non-terminating instances. Infrastructure maintenance and updates are preformed without disruptions to workloads. To use managed instance draining, set enableManagedDraining to true.
Default: true
-
getEnableManagedScaling
When enabled the scale-in and scale-out actions of the cluster's Auto Scaling Group will be managed for you.This means your cluster will automatically scale instances based on the load your tasks put on the cluster. For more information, see Using Managed Scaling in the ECS Developer Guide.
Default: true
-
getEnableManagedTerminationProtection
When enabled the Auto Scaling Group will only terminate EC2 instances that no longer have running non-daemon tasks.Scale-in protection will be automatically enabled on instances. When all non-daemon tasks are stopped on an instance, ECS initiates the scale-in process and turns off scale-in protection for the instance. The Auto Scaling Group can then terminate the instance. For more information see Managed termination protection in the ECS Developer Guide.
Managed scaling must also be enabled.
Default: true
-
getInstanceWarmupPeriod
The period of time, in seconds, after a newly launched Amazon EC2 instance can contribute to CloudWatch metrics for Auto Scaling group.Must be between 0 and 10000.
Default: 300
-
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
-