Interface AsgCapacityProviderProps

All Superinterfaces:
AddAutoScalingGroupCapacityOptions, software.amazon.jsii.JsiiSerializable
All Known Implementing Classes:
AsgCapacityProviderProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.89.0 (build 2f74b3e)", date="2023-10-26T00:56:07.280Z") @Stability(Stable) public interface AsgCapacityProviderProps extends software.amazon.jsii.JsiiSerializable, AddAutoScalingGroupCapacityOptions
The options for creating an Auto Scaling Group Capacity Provider.

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);
 
  • Method Details

    • getAutoScalingGroup

      @Stability(Stable) @NotNull IAutoScalingGroup getAutoScalingGroup()
      The autoscaling group to add as a Capacity Provider.
    • getCapacityProviderName

      @Stability(Stable) @Nullable default String getCapacityProviderName()
      The name of the capacity provider.

      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

    • getEnableManagedScaling

      @Stability(Stable) @Nullable default Boolean 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

      @Stability(Stable) @Nullable default Boolean 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

      @Stability(Stable) @Nullable default Number getMaximumScalingStepSize()
      Maximum scaling step size.

      In most cases this should be left alone.

      Default: 1000

    • getMinimumScalingStepSize

      @Stability(Stable) @Nullable default Number getMinimumScalingStepSize()
      Minimum scaling step size.

      In most cases this should be left alone.

      Default: 1

    • getTargetCapacityPercent

      @Stability(Stable) @Nullable default Number getTargetCapacityPercent()
      Target capacity percent.

      In most cases this should be left alone.

      Default: 100

    • builder

      @Stability(Stable) static AsgCapacityProviderProps.Builder builder()
      Returns:
      a AsgCapacityProviderProps.Builder of AsgCapacityProviderProps