list_instances
async
¶
list_instances(
service_id: Arn,
*,
config_overrides: Optional[AsyncServiceDiscoveryClientConfig] = None,
next_token: Optional[NextToken] = None,
max_results: Optional[MaxResults] = None,
) -> ListInstancesResponse
Lists summary information about the instances that you registered by using a specified service.
Parameters:
-
service_id(Arn) –The ID or Amazon Resource Name (ARN) of the service that you want to list instances for. 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.
-
next_token(Optional[NextToken], default:None) –For the first
ListInstancesrequest, omit this value.If more than
MaxResultsinstances match the specified criteria, you can submit anotherListInstancesrequest to get the next group of results. Specify the value ofNextTokenfrom the previous response in the next request. -
max_results(Optional[MaxResults], default:None) –The maximum number of instances that you want Cloud Map to return in the response to a
ListInstancesrequest. If you don't specify a value forMaxResults, Cloud Map returns up to 100 instances.
Raises:
-
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:
Example: List service instances Example: List service instances
>>> await client.list_instances(service_id='srv-qzpwvt2tfqcegapy')
List instances using service ARN for shared namespace
This example lists instances using a service ARN instead of service ID. This is useful for listing instances associated with shared namespaces.
>>> await client.list_instances(service_id='arn:aws:servicediscovery:us-west-2:123456789012:service/srv-e4anhexample0004')
Source code in docs_src/capo_servicediscovery/_services/async_service_discovery.py
1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 | |