Deleting an Amazon Cloud Map namespace - 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).

Deleting an Amazon Cloud Map namespace

After you're done using a namespace, you can delete it. When you delete a namespace, you can no longer use it to register or discover service instances.

Note

When you create a namespace, if you specify that you want to discover service instances using either public DNS queries or DNS queries in VPCs, Amazon Cloud Map creates an Amazon Route 53 public or private hosted zone. When you delete the namespace, Amazon Cloud Map deletes the corresponding hosted zone.

Before deleting a namespace, you must deregister all service instances and then delete all services that were created in the namespace. For more information, see Deregistering an Amazon Cloud Map service instance and Deleting an Amazon Cloud Map service.

After you've deregistered instances and deleted services that were created in a namespace, follow these steps to delete the namespace.

Amazon Web Services Management Console
  1. Sign in to the Amazon Web Services Management Console and open the Amazon Cloud Map console at https://console.amazonaws.cn/cloudmap/.

  2. In the navigation pane, choose Namespaces.

  3. Select the namespace that you want to delete, then choose Delete.

  4. Confirm that you want to delete the service by choosing Delete again.

Amazon CLI
  • Delete a namespace with the delete-namespace command (replace the red value with your own). If the namespace still contains one or more services, the request fails.

    aws servicediscovery delete-namespace --id ns-xxxxxxxxxxx
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. Delete a namespace with delete_namespace() (replace the red value with your own). If the namespace still contains one or more services, the request fails.

    response = client.delete_namespace( Id='ns-xxxxxxxxxxx', ) # If you want to see the response print(response)

    Example response output

    { 'OperationId': 'gv4g5meo7ndmeh4fqskygvk23d2fijwa-k98y6drk', 'ResponseMetadata': { '...': '...', }, }