Listing Amazon Cloud Map services in a namespace
To view a list of the services that you created in a namespace, perform the following procedure.
- Amazon Web Services Management Console
-
Sign in to the Amazon Web Services Management Console and open the Amazon Cloud Map console at https://console.amazonaws.cn/cloudmap/
. -
In the navigation pane, choose Namespaces.
-
Choose the Domain name of the namespace that contains the services that you want to list. You can view a list of all services under Services and enter the service name or ID in the search field to find a specific service. You can identify the Amazon Web Services account that created the service by using the Created by field and the account that owns the service by using the Resource owner field.
Note
If the namespace is a shared namespace, the Amazon Web Services account ID under Resource owner is the account that created and shared the namespace. The account ID under Created by can differ from the ID under Resource owner if a namespace consumer created the service. The account IDs may not be the same as your account ID. For more information about shared namespaces, see Cross-account Amazon Cloud Map namespace sharing.
- Amazon CLI
-
-
List services with the
list-services
command. The following command lists all services in a namespace using the namespace ID as the filter. Replace thered
value with your own.aws servicediscovery list-services --filters Name=NAMESPACE_ID,Values=
ns-1234567890abcdef
,Condition=EQ
-
- Amazon SDK for Python (Boto3)
-
-
If you don't already have
Boto3
installed, you can find instructions for installing, configuring, and usingBoto3
here. -
Import
Boto3
and useservicediscovery
as your service.import boto3 client = boto3.client('servicediscovery')
-
List services with
list_services()
.response = client.list_services() # If you want to see the response print(response)
Example response output
{ 'Services': [ { 'Arn': 'arn:aws-cn:servicediscovery:us-west-2:123456789012:service/srv-xxxxxxxxxxxxxxxx', 'CreateDate': 1587081768.334, 'DnsConfig': { 'DnsRecords': [ { 'TTL': 60, 'Type': 'A', }, ], 'RoutingPolicy': 'MULTIVALUE', }, 'Id': 'srv-xxxxxxxxxxxxxxxx', 'Name': 'myservice', }, ], 'ResponseMetadata': { '...': '...', }, }
-