Skip to content

UpdateContainerInstancesState

Source: src/AWS/ECS/UpdateContainerInstancesState.ts

Runtime binding for ecs:UpdateContainerInstancesState.

Bind this operation to a Cluster inside a function runtime to get a callable that transitions container instances between ACTIVE and DRAINING — the canonical building block of an Auto Scaling lifecycle-hook drain function that gracefully migrates tasks off an instance before it terminates. The cluster ARN is injected automatically and the host is granted ecs:UpdateContainerInstancesState on the cluster’s container instances.

const updateContainerInstancesState =
yield* AWS.ECS.UpdateContainerInstancesState(cluster);
yield* updateContainerInstancesState({
containerInstances: [containerInstanceArn],
status: "DRAINING",
});