Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access RDS from Lambda function

I have an Aurora cluster in RDS and a Lambda Function.

  • Both are assigned the same VPC.
  • Both have the same subnets (us-east-1 a-f)
  • Both have the same security group assigned
  • Lambda is assigned a role with AmazonRDSFullAccess, AmazonVPCFullAccess, AWSLambdaVPCAccessExecutionRole

When I run the lambda instance, I get connection timeout when trying to connect to Aurora. I'm able to access Aurora locally (with access key added to aws configure).

Any ideas what else I can check for why lambda wouldn't have access to the instance? Thank you

Update: The subnets each have the following configuration: enter image description here route table

like image 823
dzm Avatar asked Aug 18 '26 00:08

dzm


1 Answers

Both have the same security group assigned

It's a common misconception that members of the same security group can communicate with each other by virtue of being members of the same group. This is not the case. Being members of the same group only means they follow the same set of rules.

Members of a security group can only access other members of the group if the group allows access to itself.

Instances associated with a security group can't talk to each other unless you add rules allowing it (exception: the default security group has these rules by default).

http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_SecurityGroups.html

Add a rule to this group for "MySQL/Aurora" traffic, but instead of entering an IP address, enter the sg-xxxxxxxx identifier of the security group.

like image 58
Michael - sqlbot Avatar answered Aug 22 '26 00:08

Michael - sqlbot