简体   繁体   中英

AWS Lambda access to RDS outside VPC

The RDS instance is not on VPC (Classic); it is associated to a security group with allowances to some CIDR/IPs and EC2 security groups.

I want to create a AWS Lambda function that will execute some SQL statements on this database, and also make requests to a EC2 instance that is in the same security group. Is it possible to allow Lambda to access this database?

You have two options:

1) Lambda function outside VPC: Set the RDS to "Publicly Accessible" and in the security group allow access from everywhere (because the set of Lambda IPs is not known).

2) Lambda function inside VPC: Allow access to RDS from all IPs in the VPC because the Lambda function will get an IP from the available ones in your VPC. Beware: If the Lambda function is run multiple times in parallel, your VPC may run out of IPs, making your Lambda function fail.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM