interface AddAutoScalingGroupCapacityOptions
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.ECS.AddAutoScalingGroupCapacityOptions |
Java | software.amazon.awscdk.services.ecs.AddAutoScalingGroupCapacityOptions |
Python | aws_cdk.aws_ecs.AddAutoScalingGroupCapacityOptions |
TypeScript (source) | @aws-cdk/aws-ecs » AddAutoScalingGroupCapacityOptions |
The properties for adding an AutoScalingGroup.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as ecs from '@aws-cdk/aws-ecs';
import * as kms from '@aws-cdk/aws-kms';
import * as cdk from '@aws-cdk/core';
declare const key: kms.Key;
const addAutoScalingGroupCapacityOptions: ecs.AddAutoScalingGroupCapacityOptions = {
canContainersAccessInstanceRole: false,
machineImageType: ecs.MachineImageType.AMAZON_LINUX_2,
spotInstanceDraining: false,
taskDrainTime: cdk.Duration.minutes(30),
topicEncryptionKey: key,
};
Properties
Name | Type | Description |
---|---|---|
can | boolean | Specifies whether the containers can access the container instance role. |
machine | Machine | What type of machine image this is. |
spot | boolean | Specify whether to enable Automated Draining for Spot Instances running Amazon ECS Services. |
task | Duration | The time period to wait before force terminating an instance that is draining. |
topic | IKey | If {@link AddAutoScalingGroupCapacityOptions.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 for more information. |
canContainersAccessInstanceRole?
Type:
boolean
(optional, default: false)
Specifies whether the containers can access the container instance role.
machineImageType?
Type:
Machine
(optional, default: Automatically determined from machineImage
, if available, otherwise MachineImageType.AMAZON_LINUX_2
.)
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 via
addAutoScalingGroup()
, you must specify this value. If you are adding an
autoScalingGroup
via addCapacity
, this value will be determined
from the machineImage
you pass.
spotInstanceDraining?
Type:
boolean
(optional, default: false)
Specify whether to enable Automated Draining for Spot Instances running Amazon ECS Services.
For more information, see Using Spot Instances.
taskDrainTime?
⚠️ Deprecated: The lifecycle draining hook is not configured if using the EC2 Capacity Provider. Enable managed termination protection instead.
Type:
Duration
(optional, default: Duration.minutes(5))
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.
topicEncryptionKey?
Type:
IKey
(optional, default: The SNS Topic will not be encrypted.)
If {@link AddAutoScalingGroupCapacityOptions.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 for more information.