Creating Services - Amazon Cloud Map
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

Creating Services

To create a service, perform the following procedure.

Amazon Web Services Management Console
  1. Sign in to the Amazon Web Services Management Console and open the Amazon Cloud Map console at

  2. In the navigation pane, choose Namespaces.

  3. On the Namespaces page, choose the namespace that you want to add the service to.

  4. On the Namespace: namespace-name page, choose Create service.

  5. On the Create service page, enter the applicable values. For more information, see Values That You Specify When You Create Services.

  6. Choose Create service.

Amazon CLI
  • Create a service with the create-service command (replace the red value with your own).

    aws servicediscovery create-service \ --name service-name \ --namespace-id ns-xxxxxxxxxxx \ --dns-config "NamespaceId=ns-xxxxxxxxxxx,RoutingPolicy=MULTIVALUE,DnsRecords=[{Type=A,TTL=60}]"


    { "Service": { "Id": "srv-xxxxxxxxxxx", "Arn": "arn:aws-cn:servicediscovery:us-west-2:123456789012:service/srv-xxxxxxxxxxx", "Name": "service-name", "NamespaceId": "ns-xxxxxxxxxxx", "DnsConfig": { "NamespaceId": "ns-xxxxxxxxxxx", "RoutingPolicy": "MULTIVALUE", "DnsRecords": [ { "Type": "A", "TTL": 60 } ] }, "CreateDate": 1587081768.334, "CreatorRequestId": "567c1193-6b00-4308-bd57-ad38a8822d25" } }
Amazon SDK for Python (Boto3)
  1. If you don't already have Boto3 installed, you can find instructions for installing, configuring, and using Boto3 here.

  2. Import Boto3 and use servicediscovery as your service.

    import boto3 client = boto3.client('servicediscovery')
  3. Create a service with create_service() (replace the red value with your own).

    response = client.create_service( DnsConfig={ 'DnsRecords': [ { 'TTL': 60, 'Type': 'A', }, ], 'NamespaceId': 'ns-xxxxxxxxxxx', 'RoutingPolicy': 'MULTIVALUE', }, Name='service-name', NamespaceId='ns-xxxxxxxxxxx', )

    Example response output

    { 'Service': { 'Arn': 'arn:aws-cn:servicediscovery:us-west-2:123456789012:service/srv-xxxxxxxxxxx', 'CreateDate': 1587081768.334, 'DnsConfig': { 'DnsRecords': [ { 'TTL': 60, 'Type': 'A', }, ], 'NamespaceId': 'ns-xxxxxxxxxxx', 'RoutingPolicy': 'MULTIVALUE', }, 'Id': 'srv-xxxxxxxxxxx', 'Name': 'service-name', 'NamespaceId': 'ns-xxxxxxxxxxx', }, 'ResponseMetadata': { '...': '...', }, }

For services that are accessible by DNS queries, you cannot create multiple services with names that differ only by case (such as EXAMPLE and example). Otherwise, these services will have the same DNS name. If you use a namespace that's only accessible by API calls, then you can create services that with names that differ only by case.