Unable to Connect to AWS ElastiCache Memcached from ECS Fargate Task

I have an ECS Fargate service that’s trying to connect to an AWS ElastiCache Memcached cluster, but it’s failing to establish the connection

ECS Fargate: Running in vpc-BackendServer with security group sg-backendSecurityGroup.
ElastiCache (Memcached): Deployed in the same VPC (vpc-BackendServer) with IP 10.0.0.38 and security group sg-elasticCacheSecurityGroup.
Security Groups:
ElastiCache allows inbound on port 11211 from sg-backendSecurityGroup.
Fargate’s security group allows outbound to sg-elasticCacheSecurityGroup on port 11211 within custom TCP, but also All traffic outbound.
DNS Resolution: The ElastiCache cluster endpoint .X.X.X.cache.amazonaws.com resolves correctly to 10.0.0.38.
Client & Server Versions: My local Memcached client library version is 2.2.2, while the ElastiCache Memcached engine version is 1.6.17.

I’ve verified security group rules, NACLs, and ensured both the ECS task and ElastiCache cluster are in the same VPC and subnets. VPC Flow Logs don’t show any traffic to any address related to the ElasticCache. Has anyone faced a similar issue or can provide insights on what I might be missing?

Leave a Comment