I am trying to get ECS Service Connect to work our services. But for some reason, just not able to get it to work. What we have in place:
- One service (
admin) needs to get some data from another service (metrics). - Both services are deployed on ECS
- The containers in both services are using the
awsvpcnetwork mode - Service Connect has been configured for both services
Service Connect for Metrics Service
Service Connect for Admin Service
Both services are in the same cluster and using the same Service Connect Namespace (service-discovery-cluster).
This is reflected in CloudMap entry for the Namespace.
CloudMap entries for the services
So far, all this was as expected. And the services are accessible via an ALB and working fine.
However, I would have expected that the Admin Service can call the Metric service with http://metrics.service-discovery-cluster (the recommended http://service-dns.cluster pattern), but this cannot be resolved by the HTTP Library.
I know I am missing something very basic somewhere but just can't work it out.
Could someone help out, please?
Other details:
- I am using Unirest with Java (I don't think that should matter, but still)
- All tasks have
awsvpcnetworking mode - Exact error:
java.net.UnknownHostException: metrics.service-discovery-cluster: Name or service not known
I tried using ports for the services (e.g., http://metrics.service-discovery-cluster:8084), but that didn't work either.
Since a DNS name is specified, the service connect endpoint would be
http://metrics:8084.If this (optional) DNS field is not specified, then the endpoint would be
http://metrics.service-discovery-cluster:8084(the recommended pattern).The service connect endpoints that are created for an ECS service are visible in the Configuration and networking tab -> Service Connect section of the service in the ECS management console.
For the service connect configuration shown below, wherein a DNS name is specified for one,
service_connect_configuration
the endpoints created are as shown below
service_connect_endpoints.