- Newest
- Most votes
- Most comments
When you create the Cloud Map service directly using CDK or CloudFormation, you cannot specify the port for the service. This is because the Cloud Map service is designed to be a general-purpose service discovery mechanism, and it does not have the concept of a specific port associated with the registered service. You can specify port while you are registering an instance with the service created. For more information on how to specify port while registering an instance in your service refer the below document. [+] https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_servicediscovery-readme.html
When you create the Cloud Map service indirectly by integrating it with an ECS configuration, you are correct that you cannot directly access the ARN of the Cloud Map service using CDK. This is because the Cloud Map service is created as an implementation detail of the ECS service, and its ARN is not exposed as a separate output. You can use the aws_ecs.CfnService.ServiceRegistryProperty class in CDK. This class provides access to the registryArn property, which you can use to retrieve the ARN of the associated Cloud Map service. [+] https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.CfnService.ServiceRegistryProperty.html
Relevant content
- asked 3 months ago
- Accepted Answerasked a year ago
- asked 8 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 14 days ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 3 months ago
"... it does not have the concept of a specific port associated with the registered service. You can specify port while you are registering an instance with the service created" - Correct, I am attempting to specify a port when registering an instance as I said: " If I create a Service Discover Service with an L1 construct and attempt to register an instance using the serviceRegistries property on the ECS Service, I can not specify a port"
In regards to the aws_ecs.CfnService.ServiceRegistryProperty Interface, can you give me an example of usage? I can't quite figure out how it will be useful in my case.