UNPKG

1.54 kBTypeScriptView Raw
1import * as autoscaling from '@aws-cdk/aws-autoscaling';
2import * as kms from '@aws-cdk/aws-kms';
3import * as cdk from '@aws-cdk/core';
4import { Construct } from 'constructs';
5import { ICluster } from '../cluster';
6import { Construct as CoreConstruct } from '@aws-cdk/core';
7/**
8 * Properties for instance draining hook
9 */
10export interface InstanceDrainHookProps {
11 /**
12 * The AutoScalingGroup to install the instance draining hook for
13 */
14 autoScalingGroup: autoscaling.IAutoScalingGroup;
15 /**
16 * The cluster on which tasks have been scheduled
17 */
18 cluster: ICluster;
19 /**
20 * How many seconds to give tasks to drain before the instance is terminated anyway
21 *
22 * Must be between 0 and 15 minutes.
23 *
24 * @default Duration.minutes(15)
25 */
26 drainTime?: cdk.Duration;
27 /**
28 * The InstanceDrainHook creates an SNS topic for the lifecycle hook of the ASG. If provided, then this
29 * key will be used to encrypt the contents of that SNS Topic.
30 * See [SNS Data Encryption](https://docs.aws.amazon.com/sns/latest/dg/sns-data-encryption.html) for more information.
31 *
32 * @default The SNS Topic will not be encrypted.
33 */
34 topicEncryptionKey?: kms.IKey;
35}
36/**
37 * A hook to drain instances from ECS traffic before they're terminated
38 */
39export declare class InstanceDrainHook extends CoreConstruct {
40 /**
41 * Constructs a new instance of the InstanceDrainHook class.
42 */
43 constructor(scope: Construct, id: string, props: InstanceDrainHookProps);
44}