Skip to content

UpdateTaskProtection

Source: src/AWS/ECS/UpdateTaskProtection.ts

Runtime binding for ecs:UpdateTaskProtection.

Bind this operation to a Cluster inside a function runtime to get a callable that toggles scale-in protection on service-managed tasks in the bound cluster — the canonical pattern is a task protecting itself while it processes long-running work so deployments and scale-in don’t terminate it. The cluster ARN is injected automatically and the host is granted ecs:UpdateTaskProtection on the cluster’s tasks.

const updateTaskProtection = yield* AWS.ECS.UpdateTaskProtection(cluster);
yield* updateTaskProtection({
tasks: [taskArn],
protectionEnabled: true,
expiresIn: "30 minutes",
});