Skip to content

TerminateInstanceInAutoScalingGroup

Source: src/AWS/AutoScaling/TerminateInstanceInAutoScalingGroup.ts

Runtime binding for the TerminateInstanceInAutoScalingGroup operation (IAM action autoscaling:TerminateInstanceInAutoScalingGroup scoped to the group ARN).

Requests termination of a specific instance, optionally decrementing the desired capacity — e.g. recycling a wedged worker (the group launches a replacement) or retiring the instance it runs on. Provide the implementation with Effect.provide(AWS.AutoScaling.TerminateInstanceInAutoScalingGroupHttp).

// init — bind the operation to the group
const terminateInstance =
yield* AWS.AutoScaling.TerminateInstanceInAutoScalingGroup(group);
// runtime — terminate and let the group launch a replacement
const { Activity } = yield* terminateInstance({
InstanceId: instanceId,
ShouldDecrementDesiredCapacity: false,
});