Search code examples
amazon-web-servicesaws-lambdaamazon-elasticacheserverless-framework

AWS Lambda connection timeout to Elasticache


I am trying to make Serverless work with Elasticache. I wrote a custom CloudFormation file based on serverless-examples/serverless-infrastructure repo. I managed to put Elasticache and Lambda in one subnet (checked with the cli). I retrieve the host and the port from the Outputs, but whenever I am trying to connect with node-redis the connection times out. Here are the relevant parts:


Solution

  • As Tolbahady pointed out, the only solution was to create an NAT within the VPC.