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
Nested ClassesModifier and TypeInterfaceDescriptionstatic final classA builder forAsgCapacityProviderPropsstatic final classAn implementation forAsgCapacityProviderProps -
Method Summary
Modifier and TypeMethodDescriptionbuilder()The autoscaling group to add as a Capacity Provider.default StringThe name of the capacity provider.default BooleanWhen enabled the scale-in and scale-out actions of the cluster's Auto Scaling Group will be managed for you.default BooleanWhen enabled the Auto Scaling Group will only terminate EC2 instances that no longer have running non-daemon tasks.default NumberMaximum scaling step size.default NumberMinimum scaling step size.default NumberTarget capacity percent.Methods inherited from interface software.amazon.awscdk.services.ecs.AddAutoScalingGroupCapacityOptions
getCanContainersAccessInstanceRole, getMachineImageType, getSpotInstanceDraining, getTopicEncryptionKeyMethods 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
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
-
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.BuilderofAsgCapacityProviderProps
-