get_instances_health_status
async
¶
get_instances_health_status(
service_id: Arn,
*,
config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None,
instances: Optional[InstanceIdList] = None,
max_results: Optional[MaxResults] = None,
next_token: Optional[NextToken] = None,
) -> GetInstancesHealthStatusResponse
Gets the current health status (Healthy, Unhealthy, or Unknown) of one or more instances that are associated with a specified service.
There's a brief delay between when you register an instance and when the health status for the instance is available.
Parameters:
-
service_id(Arn) –The ID or Amazon Resource Name (ARN) of the service that the instance is associated with. For services created in a shared namespace, specify the service ARN. For more information about shared namespaces, see Cross-account Cloud Map namespace sharing in the Cloud Map Developer Guide.
-
instances(Optional[InstanceIdList], default:None) –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.To get the IDs for the instances that you've registered by using a specified service, submit a ListInstances request.
-
max_results(Optional[MaxResults], default:None) –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 forMaxResults, Cloud Map returns up to 100 instances. -
next_token(Optional[NextToken], default:None) –For the first
GetInstancesHealthStatusrequest, omit this value.If more than
MaxResultsinstances match the specified criteria, you can submit anotherGetInstancesHealthStatusrequest to get the next group of results. Specify the value ofNextTokenfrom the previous response in the next request.
Raises:
-
InstanceNotFound–No instance exists with the specified ID, or the instance was recently registered, and information about the instance hasn't propagated yet.
-
InvalidInput–One or more specified values aren't valid. For example, a required value might be missing, a numeric value might be outside the allowed range, or a string value might exceed length constraints.
-
ServiceNotFound–No service exists with the specified ID.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
GetInstancesHealthStatus example This example gets the current health status of one or more instances that are associate with a specified service.
>>> await client.get_instances_health_status(service_id='srv-e4anhexample0004')
Get instances health status using service ARN for shared namespace
This example gets the current health status of instances using a service ARN instead of service ID. This is useful for checking health status of instances associated with shared namespaces.
>>> await client.get_instances_health_status(service_id='arn:aws:servicediscovery:us-west-2:123456789012:service/srv-e4anhexample0004')
Source code in docs_src/capo_servicediscovery/_services/async_service_discovery.py
1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 | |