Skip to content

SetInstanceProtection

Source: src/AWS/AutoScaling/SetInstanceProtection.ts

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

Toggles scale-in protection on instances — e.g. a worker protects itself while it processes a long-running job, then removes protection when idle so the group may reclaim it. Provide the implementation with Effect.provide(AWS.AutoScaling.SetInstanceProtectionHttp).

// init — bind the operation to the group
const setInstanceProtection =
yield* AWS.AutoScaling.SetInstanceProtection(group);
// runtime — protect while working, release when idle
yield* setInstanceProtection({
InstanceIds: [instanceId],
ProtectedFromScaleIn: true,
});