get_instances_health_status
(**kwargs)¶Gets the current health status ( Healthy
, Unhealthy
, or Unknown
) of one or more instances that are associated with a specified service.
Note
There's a brief delay between when you register an instance and when the health status for the instance is available.
See also: AWS API Documentation
Request Syntax
response = client.get_instances_health_status(
ServiceId='string',
Instances=[
'string',
],
MaxResults=123,
NextToken='string'
)
[REQUIRED]
The ID of the service that the instance is associated with.
An array that contains the IDs of all the instances that you want to get the health status for.
If you omit Instances
, Cloud Map returns the health status for all the instances that are associated with the specified service.
Note
To get the IDs for the instances that you've registered by using a specified service, submit a ListInstances request.
GetInstancesHealthStatus
request. If you don't specify a value for MaxResults
, Cloud Map returns up to 100 instances.For the first GetInstancesHealthStatus
request, omit this value.
If more than MaxResults
instances match the specified criteria, you can submit another GetInstancesHealthStatus
request to get the next group of results. Specify the value of NextToken
from the previous response in the next request.
dict
Response Syntax
{
'Status': {
'string': 'HEALTHY'|'UNHEALTHY'|'UNKNOWN'
},
'NextToken': 'string'
}
Response Structure
(dict) --
Status (dict) --
A complex type that contains the IDs and the health status of the instances that you specified in the GetInstancesHealthStatus
request.
NextToken (string) --
If more than MaxResults
instances match the specified criteria, you can submit another GetInstancesHealthStatus
request to get the next group of results. Specify the value of NextToken
from the previous response in the next request.
Exceptions
ServiceDiscovery.Client.exceptions.InstanceNotFound
ServiceDiscovery.Client.exceptions.InvalidInput
ServiceDiscovery.Client.exceptions.ServiceNotFound
Examples
This example gets the current health status of one or more instances that are associate with a specified service.
response = client.get_instances_health_status(
ServiceId='srv-e4anhexample0004',
)
print(response)
Expected Output:
{
'Status': {
'i-abcd1234': 'HEALTHY',
'i-abcd1235': 'UNHEALTHY',
},
'ResponseMetadata': {
'...': '...',
},
}