简体   繁体   English

AWS Lambda访问VPC外部的RDS

[英]AWS Lambda access to RDS outside VPC

The RDS instance is not on VPC (Classic); RDS实例不在VPC(Classic)上; it is associated to a security group with allowances to some CIDR/IPs and EC2 security groups. 它与允许某些CIDR / IP和EC2安全组的安全组相关联。

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. 我想创建一个AWS Lambda函数,该函数将在此数据库上执行一些SQL语句,并且还向同一安全组中的EC2实例发出请求。 Is it possible to allow Lambda to access this database? 是否可以允许Lambda访问此数据库?

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). 1)VPC外部的Lambda函数:将RDS设置为“公共可访问”,并且在安全组中允许从任何地方进行访问(因为未知的Lambda IP集)。

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. 2)VPC内部的Lambda函数:允许从VPC中的所有IP访问RDS,因为Lambda函数将从您的VPC中的可用IP获取IP。 Beware: If the Lambda function is run multiple times in parallel, your VPC may run out of IPs, making your Lambda function fail. 注意:如果Lambda函数并行运行多次,则您的VPC可能会耗尽IP,从而导致Lambda函数失败。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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