Skip to content

SetInstanceHealth

Source: src/AWS/AutoScaling/SetInstanceHealth.ts

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

Reports an instance’s health to EC2 Auto Scaling — the backbone of custom health checks: a watchdog Lambda (or the instance itself) flags an instance Unhealthy and the group replaces it. Provide the implementation with Effect.provide(AWS.AutoScaling.SetInstanceHealthHttp).

// init — bind the operation to the group
const setInstanceHealth = yield* AWS.AutoScaling.SetInstanceHealth(group);
// runtime — mark the instance unhealthy so the group replaces it
yield* setInstanceHealth({
InstanceId: instanceId,
HealthStatus: "Unhealthy",
});