- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
SetInstanceHealthCommand
Sets the health status of the specified instance.
For more information, see Set up a custom health check for your Auto Scaling group in the Amazon EC2 Auto Scaling User Guide.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { AutoScalingClient, SetInstanceHealthCommand } from "@aws-sdk/client-auto-scaling"; // ES Modules import
// const { AutoScalingClient, SetInstanceHealthCommand } = require("@aws-sdk/client-auto-scaling"); // CommonJS import
const client = new AutoScalingClient(config);
const input = { // SetInstanceHealthQuery
InstanceId: "STRING_VALUE", // required
HealthStatus: "STRING_VALUE", // required
ShouldRespectGracePeriod: true || false,
};
const command = new SetInstanceHealthCommand(input);
const response = await client.send(command);
// {};
Example Usage
SetInstanceHealthCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
HealthStatus Required | string | undefined | The health status of the instance. Set to |
InstanceId Required | string | undefined | The ID of the instance. |
ShouldRespectGracePeriod | boolean | undefined | If the Auto Scaling group of the specified instance has a For more information about the health check grace period, see Set the health check grace period for an Auto Scaling group in the Amazon EC2 Auto Scaling User Guide. |
SetInstanceHealthCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
ResourceContentionFault | server | You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer). |
AutoScalingServiceException | Base exception class for all service exceptions from AutoScaling service. |