简体   繁体   English

如何在 AWS 中配置默认​​ VPC?

[英]How to configured Default VPC IN AWS?

i want to send mail using node mailer in NodeJS if my lambda function is developed in default VPC because I have to access RDS too from the lambda function.如果我的 lambda 函数是在默认 VPC 中开发的,我想在 NodeJS 中使用节点邮件程序发送邮件,因为我也必须从 lambda 函数访问 RDS。

I am unable to send success mail for data successfully inserted in RDS if I deployed my lambda function in default VPC WHAT changes I need to do so I can send.如果我在默认 VPC 中部署了我的 lambda 函数,我将无法为成功插入 RDS 的数据发送成功邮件,我需要做哪些更改以便我可以发送。

IF I choose NO vpc then I am unable to set data to database.如果我选择 NO vpc,则无法将数据设置到数据库。

From https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html ,https://docs.aws.amazon.com/lambda/latest/dg/configuration-vpc.html

When you connect a function to a VPC in your account, it does not have access to the internet unless your VPC provides access.当您将功能连接到您账户中的 VPC 时,除非您的 VPC 提供访问权限,否则它无法访问 Internet。

I take this to mean that if you wish to access both RDS and the internet from lambda from within your VPC, you need a NAT gatway (or to spin up your own instance).我认为这意味着如果您希望从 VPC 内的 lambda 访问 RDS 和互联网,您需要一个 NAT 网关(或启动您自己的实例)。 In other words, lambda does not support internet access with a public IP through an Internet Gateway, which is the mechanism of internet access within your vpc.换句话说,lambda 不支持通过 Internet 网关使用公共 IP 访问 Internet,这是您 vpc 内 Internet 访问的机制。

If you don't mind the cost, about 4.5 cents an hour plus data transfer last I checked, the simplest solution is probably:如果你不介意成本,加上我上次检查的数据传输大约每小时 4.5 美分,最简单的解决方案可能是:

  1. add another subnet to your VPC.将另一个子网添加到您的 VPC。
  2. Add a NAT Gateway to your VPC.将 NAT 网关添加到您的 VPC。
  3. Add a route table to the subnet that routes through the NAT Gateway向通过 NAT 网关路由的子网添加路由表
  4. put your lambda in that subnet把你的 lambda 放在那个子网中

This essentially creates a connection to the internet in that VPC without your lambda holding a Public IP address.这实质上会在该 VPC 中创建与 Internet 的连接,而您的 lambda 不会持有公共 IP 地址。

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

相关问题 AWS:在VPC中撤消SecurityGroupIngress - AWS: revokeSecurityGroupIngress within a VPC 如何配置 AWS CDK 账户和区域以查找 VPC - How to configure AWS CDK Account and Region to look up a VPC 如何修复“此处未配置默认音频设备”语音转文本 - How to fix "Here is no default audio device configured" speech-to-text 使用VPC中运行的Lambda提供的AWS开发工具包 - Using AWS SDK from Lambda running in VPC AWS Lambda无法在没有VPC的情况下调用另一个AWS Lambda-NodeJs - AWS Lambda unable to invoke another AWS Lambda with No VPC - NodeJs AWS Lambda 无法(间歇性地)连接到 AWS VPC 内的 MongoDB - AWS Lambda unable to connect (intermittently) to MongoDB inside an AWS VPC 如何设置 ask cli set default region 或 aws default region - how to set ask cli set default region or aws default region 为什么并发 AWS Lambda(在 VPC 内)执行没有抱怨 VPC 中的 IP 限制? - Why concurrent AWS Lambda (inside VPC) execution is not complaining about IP limit in VPC? 连接到 VPC 外的 AWS DocumentDB 时连接超时 - Connection timed out while connecting to AWS DocumentDB outside the VPC 从 lambda 使用 VPC 对等访问时出现 AWS DAX ConnectionException - AWS DAX ConnectionException when accessing with VPC peering from lambda
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM