ECS Service Cannot Connect: CloudMap vs. ECS Namespace


I have 2 ECS Services; one is a webserver, the other a Redis server. Both run as Fargate instances in the same ECS Cluster. The webserver cannot connect to redis. The ECS Namespace 'app.geoapp.local' shows both services: geo-webserver and app-redis (discovery name = redis-sc). So geo-webserver should be able to resolve app.geoapp.local because it is a member. But it cannot connect to redis using redis://app.geoapp.local:6379 with the error: "Cannot resolve app.geoapp.local." It connects OK to redis using the internal ip: redis://, so likely not an SG issue. Also, DNS is enabled on the VPC. So why can't the webserver resolve app.geoapp.local? Looking at the same namespace 'app.geoapp.local' in CloudMap console, it shows different services: 'redis' and 'redis-sc,' but no 'geo-webserver.' Is that normal, CloudMap and ECS Namespaces different? I could "Create Service" in CloudMap and add the webserver manually, but would that overwrite the service already listed in the ECS Namespaces version or create a separate instance? I'd like to specify that webserver DependsOn redis, but I don't see how to do that other than manually editing the CloudFormation template. Any ideas on what I should try? Thanks!

1 Answer

"The easiest solution to a problem I've been grappling with for weeks is finally here! Check out how I resolved it: AWS ECS Service Connect: Enabling Communication Between ECS Services. For more comprehensive details, visit our complete playlist: AWS ECS Comprehensive Series. Don’t forget to subscribe for more updates: Prograamer YouTube Channel."

answered a month ago

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