Class AsgCapacityProvider.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<AsgCapacityProvider>
- Enclosing class:
- AsgCapacityProvider
AsgCapacityProvider
.-
Method Summary
Modifier and TypeMethodDescriptionautoScalingGroup
(IAutoScalingGroup autoScalingGroup) The autoscaling group to add as a Capacity Provider.build()
canContainersAccessInstanceRole
(Boolean canContainersAccessInstanceRole) Specifies whether the containers can access the container instance role.capacityProviderName
(String capacityProviderName) The name of the capacity provider.static AsgCapacityProvider.Builder
enableManagedScaling
(Boolean enableManagedScaling) Whether to enable managed scaling.enableManagedTerminationProtection
(Boolean enableManagedTerminationProtection) Whether to enable managed termination protection.machineImageType
(MachineImageType machineImageType) What type of machine image this is.maximumScalingStepSize
(Number maximumScalingStepSize) Maximum scaling step size.minimumScalingStepSize
(Number minimumScalingStepSize) Minimum scaling step size.spotInstanceDraining
(Boolean spotInstanceDraining) Specify whether to enable Automated Draining for Spot Instances running Amazon ECS Services.targetCapacityPercent
(Number targetCapacityPercent) Target capacity percent.taskDrainTime
(Duration taskDrainTime) Deprecated.The lifecycle draining hook is not configured if using the EC2 Capacity Provider.topicEncryptionKey
(IKey topicEncryptionKey) IfAddAutoScalingGroupCapacityOptions.taskDrainTime
is non-zero, then the ECS cluster creates an SNS Topic to as part of a system to drain instances of tasks when the instance is being shut down.
-
Method Details
-
create
@Stability(Stable) public static AsgCapacityProvider.Builder create(software.constructs.Construct scope, String id) - Parameters:
scope
- This parameter is required.id
- This parameter is required.- Returns:
- a new instance of
AsgCapacityProvider.Builder
.
-
canContainersAccessInstanceRole
@Stability(Stable) public AsgCapacityProvider.Builder canContainersAccessInstanceRole(Boolean canContainersAccessInstanceRole) Specifies whether the containers can access the container instance role.Default: false
- Parameters:
canContainersAccessInstanceRole
- Specifies whether the containers can access the container instance role. This parameter is required.- Returns:
this
-
machineImageType
@Stability(Stable) public AsgCapacityProvider.Builder machineImageType(MachineImageType machineImageType) What type of machine image this is.Depending on the setting, different UserData will automatically be added to the
AutoScalingGroup
to configure it properly for use with ECS.If you create an
AutoScalingGroup
yourself and are adding it viaaddAutoScalingGroup()
, you must specify this value. If you are adding anautoScalingGroup
viaaddCapacity
, this value will be determined from themachineImage
you pass.Default: - Automatically determined from `machineImage`, if available, otherwise `MachineImageType.AMAZON_LINUX_2`.
- Parameters:
machineImageType
- What type of machine image this is. This parameter is required.- Returns:
this
-
spotInstanceDraining
@Stability(Stable) public AsgCapacityProvider.Builder spotInstanceDraining(Boolean spotInstanceDraining) Specify whether to enable Automated Draining for Spot Instances running Amazon ECS Services.For more information, see Using Spot Instances.
Default: false
- Parameters:
spotInstanceDraining
- Specify whether to enable Automated Draining for Spot Instances running Amazon ECS Services. This parameter is required.- Returns:
this
-
taskDrainTime
@Stability(Deprecated) @Deprecated public AsgCapacityProvider.Builder taskDrainTime(Duration taskDrainTime) Deprecated.The lifecycle draining hook is not configured if using the EC2 Capacity Provider. Enable managed termination protection instead.(deprecated) The time period to wait before force terminating an instance that is draining.This creates a Lambda function that is used by a lifecycle hook for the AutoScalingGroup that will delay instance termination until all ECS tasks have drained from the instance. Set to 0 to disable task draining.
Set to 0 to disable task draining.
Default: Duration.minutes(5)
- Parameters:
taskDrainTime
- The time period to wait before force terminating an instance that is draining. This parameter is required.- Returns:
this
-
topicEncryptionKey
IfAddAutoScalingGroupCapacityOptions.taskDrainTime
is non-zero, then the ECS cluster creates an SNS Topic to as part of a system to drain instances of tasks when the instance is being shut down. If this property is provided, then this key will be used to encrypt the contents of that SNS Topic. See [SNS Data Encryption](https://docs.aws.amazon.com/sns/latest/dg/sns-data-encryption.html) for more information.Default: The SNS Topic will not be encrypted.
- Parameters:
topicEncryptionKey
- IfAddAutoScalingGroupCapacityOptions.taskDrainTime
is non-zero, then the ECS cluster creates an SNS Topic to as part of a system to drain instances of tasks when the instance is being shut down. If this property is provided, then this key will be used to encrypt the contents of that SNS Topic. See [SNS Data Encryption](https://docs.aws.amazon.com/sns/latest/dg/sns-data-encryption.html) for more information. This parameter is required.- Returns:
this
-
autoScalingGroup
@Stability(Stable) public AsgCapacityProvider.Builder autoScalingGroup(IAutoScalingGroup autoScalingGroup) The autoscaling group to add as a Capacity Provider.- Parameters:
autoScalingGroup
- The autoscaling group to add as a Capacity Provider. This parameter is required.- Returns:
this
-
capacityProviderName
@Stability(Stable) public AsgCapacityProvider.Builder capacityProviderName(String capacityProviderName) 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
- Parameters:
capacityProviderName
- The name of the capacity provider. This parameter is required.- Returns:
this
-
enableManagedScaling
@Stability(Stable) public AsgCapacityProvider.Builder enableManagedScaling(Boolean enableManagedScaling) Whether to enable managed scaling.Default: true
- Parameters:
enableManagedScaling
- Whether to enable managed scaling. This parameter is required.- Returns:
this
-
enableManagedTerminationProtection
@Stability(Stable) public AsgCapacityProvider.Builder enableManagedTerminationProtection(Boolean enableManagedTerminationProtection) Whether to enable managed termination protection.Default: true
- Parameters:
enableManagedTerminationProtection
- Whether to enable managed termination protection. This parameter is required.- Returns:
this
-
maximumScalingStepSize
@Stability(Stable) public AsgCapacityProvider.Builder maximumScalingStepSize(Number maximumScalingStepSize) Maximum scaling step size.In most cases this should be left alone.
Default: 1000
- Parameters:
maximumScalingStepSize
- Maximum scaling step size. This parameter is required.- Returns:
this
-
minimumScalingStepSize
@Stability(Stable) public AsgCapacityProvider.Builder minimumScalingStepSize(Number minimumScalingStepSize) Minimum scaling step size.In most cases this should be left alone.
Default: 1
- Parameters:
minimumScalingStepSize
- Minimum scaling step size. This parameter is required.- Returns:
this
-
targetCapacityPercent
@Stability(Stable) public AsgCapacityProvider.Builder targetCapacityPercent(Number targetCapacityPercent) Target capacity percent.In most cases this should be left alone.
Default: 100
- Parameters:
targetCapacityPercent
- Target capacity percent. This parameter is required.- Returns:
this
-
build
- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<AsgCapacityProvider>
- Returns:
- a newly built instance of
AsgCapacityProvider
.
-