vettipayyan
vettipayyan

Reputation: 3308

Cannot connect Lambda to ElastiCache Redis cluster

I am having issues connecting Elasticache from a Lambda function I have done the following:

  1. Created a new security group
  2. Assign security group to Lambda and assigned two private subnets of same VPC
  3. Created an Elasticache redis cluster and assigned the above security group
  4. Created a NAT gateway address, assigned and ElasticIP (for the above VPC)

Internet works and I verified this by opening stackoverflow.com URL. However Elasticache auto discovery times out. Is there any additional configuration that needs to be done?

Update I added inbound rule for Security Group to port 6379 and now still times out.

Upvotes: 3

Views: 6863

Answers (1)

Ryan Hunt
Ryan Hunt

Reputation: 51

You will need to attach an IAM policy to the Lambda execution role that grants it the appropriate access permission to ElastiCache. If you are restricting access you will also need to check the VPC setting of the Lambda function and make sure it has the ability to access the subnet the EC cluster is located.

Take a look at the following article for specifics:

https://docs.aws.amazon.com/lambda/latest/dg/services-elasticache-tutorial.html

Upvotes: 0

Related Questions