ServiceDiscovery / Client / get_instances_health_status
get_instances_health_status#
- ServiceDiscovery.Client.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' ) - Parameters:
- ServiceId (string) – - [REQUIRED] - The ID of the service that the instance is associated with. 
- Instances (list) – - 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. - (string) – 
 
- MaxResults (integer) – The maximum number of instances that you want Cloud Map to return in the response to a - GetInstancesHealthStatusrequest. If you don’t specify a value for- MaxResults, Cloud Map returns up to 100 instances.
- NextToken (string) – - For the first - GetInstancesHealthStatusrequest, omit this value.- If more than - MaxResultsinstances match the specified criteria, you can submit another- GetInstancesHealthStatusrequest to get the next group of results. Specify the value of- NextTokenfrom the previous response in the next request.
 
- Return type:
- dict 
- Returns:
- 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 - GetInstancesHealthStatusrequest.- (string) – - (string) – 
 
 
- NextToken (string) – - If more than - MaxResultsinstances match the specified criteria, you can submit another- GetInstancesHealthStatusrequest to get the next group of results. Specify the value of- NextTokenfrom 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': { '...': '...', }, }