How Are Cloud Map Service IDs Generated?

0

How Are Cloud Map Service IDs Generated?

I am creating a Service via CDK. It seems like no matter how many times I destroy and re deploy the Service it always has the same ID.

1 Answer
1
Accepted Answer

The Service IDs in AWS Cloud Map are generated based on a combination of factors, including the namespace, service name, and other attributes specified when creating the service.

When you create a service using the AWS CDK, the service ID is typically generated based on the following:

  1. Namespace ID: The ID of the namespace in which the service is created. This is determined by the namespace resource you create in your CDK application.
  2. Service Name: The name you provide for the service when creating the aws_servicediscovery.Service resource in your CDK application.
  3. Other Attributes: Depending on the configuration of your service, other attributes like the service type, routing policy, and health check configurations may also contribute to the generated service ID.

The key point is that the service ID is not randomly generated, but rather, it is derived from the specific attributes of the service you create. This ensures that the service ID remains consistent across deployments, as long as the underlying configuration remains the same.

If you are destroying and redeploying the same service with the same configuration, the service ID will remain the same, as the input parameters used to generate the ID have not changed. To verify the service ID, you can check the output of your CDK application or inspect the service in the AWS Cloud Map console after deployment. The service ID should be consistent across deployments, unless you change the underlying configuration that contributes to the ID generation.

If you wish to generate a new service ID, you can try modifying the service name or other attributes that contribute to the ID, and then redeploying the service. Alternatively, you can delete the existing namespace and recreate it, which will generate new service IDs for all services within that namespace.

AWS
answered 2 months ago
  • Can you share the specifics of the calculation? I need to resolve the ID of a service created and managed by ECS and am struggling to do so with CDK.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions