Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 213
Obro Avatar asked Nov 28 '25 14:11

Obro


1 Answers

I have no idea what contributed to the solution, but after exhausting all other attempts, I just deleted my cluster and created a new one, the only difference was "Encrypt in Traffic" which doesn't make sense cause I wasn't even getting any traffic between services in my Flow Log.

Anyways either:

  1. The original I made was made with a random VPC or I chose "Create new". Which setup services I'm unaware of. (Second time I setup the Cluster with it initially assigned to the correct VPC.
  2. Or it could have been that I didn't understand how to use "Encrypt in Traffic" feature
like image 61
Obro Avatar answered Nov 30 '25 02:11

Obro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!