简体   繁体   English

为什么将VPC与AWS Lambda或AWS DynamoDB一起使用?

[英]Why use a VPC with AWS Lambda or AWS DynamoDB?

I read many people struggling connection their Lambda to their DynamoDB, because they live in a VPC. 我读到很多人因为Lambda与他们的DynamoDB而挣扎,因为他们生活在VPC中。 But my question is, why use a VPC at all? 但是我的问题是,为什么要使用VPC?

VPC are meant to protect services with a direct connection to the outside world (AKA internet). VPC旨在通过与外部世界(AKA互联网)直接连接来保护服务。 Things like RDS for instance, which are just sitting ducks waiting to be queried by anyone knowing the URL, and therefore can be victim of DDoS, or zero day exploits that could bypass the credentials, amongst other things. 例如RDS之类的事情,就是坐鸭子,等待任何知道URL的人查询,因此可能成为DDoS的受害者,或者是零日漏洞利用,可能绕过凭据。

But, AWS Lambda and DynamoDB aren't such things, they don't have a direct connection to internet. 但是,AWS Lambda和DynamoDB并非如此,它们没有与互联网的直接连接。 Their access is protected by IAM credentials and are de-facto, secure for such DDoS/0Day exploits. 他们的访问受到IAM凭据的保护,并且事实上对于此类DDoS / 0Day攻击是安全的。

Hence the question, why use a VPC for Lambda/DynamoDB if they don't benefit from it but on the contrary make things more complicated to configure? 因此,有一个问题,如果Lambda / DynamoDB无法从中受益,为什么还要为其使用VPC,反而会使配置变得更加复杂呢?

I don't see the benefits of using a VPC for either Lambda nor DynamoDB. 我没有看到为Lambda或DynamoDB使用VPC的好处。

But maybe my understanding is wrong? 但是也许我的理解是错误的?

If your Lambda function only needs to connect to DynamoDB, then it would be wrong to place the Lambda function in a VPC. 如果您的Lambda函数仅需要连接到DynamoDB,则将Lambda函数放置在VPC中将是错误的。

If your Lambda function needs to access an EC2 instance or an RDS instance or some other service running inside the VPC, and also needs to connect to DynamoDB, then the Lambda function would have to run in the VPC and you would need to provide access to DynamoDB via a VPC Endpoint or a NAT Gateway. 如果您的Lambda函数需要访问VPC内运行的EC2实例或RDS实例或其他服务,并且还需要连接到DynamoDB,则Lambda函数必须在VPC中运行,并且您需要提供对通过VPC端点或NAT网关的DynamoDB。

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

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