邮件在VPC后面的Django AWS Lambda(Zappa)中无法正常工作 [英] Mailing isn't working in Django AWS Lambda (Zappa) behind a VPC

查看:135
本文介绍了邮件在VPC后面的Django AWS Lambda(Zappa)中无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在VPC内运行的AWS lambda函数(Django zappa),因此由于Lambda未连接到互联网,所以我无法发送电子邮件,我尝试了NAT Gatway,但没有希望.

I have an AWS lambda function (Django zappa) that is running inside a VPC thus I'm not able to send emails because Lambda isn't connected to the internet, I tried NAT Gatway but with no hope.

  • 我使用VPC的一个公共子网创建了NAT网关.
  • 使用路由表创建了另一个私有子网,该路由表将0.0.0.0/0路由到NAT网关.

我将不胜感激.

推荐答案

转到 VPC仪表板,然后使用启动VPC仪表板

创建(分配)一个弹性IP 地址,并使其方便使用.选择选项具有公共子网和私有子网的VPC

Create (Allocate) an elastic IP address and keep it handy. Select the option VPC with Public and Private Subnets

配置子网CIDR,并在表单中关联上一步中创建的弹性IP .这将创建一个NAT网关,并使用正确的路由表自动进行设置.

Configure the subnet CIDRs and associate the elastic IP created in the previous step in the form. This will create a NAT Gateway and set it up automatically with correct route tables.

注意事项:

  • NAT网关应始终位于公共子网中.
  • 专用子网的路由表应该具有到NAT网关的路由0.0.0.0/0
  • 公共子网的路由表应具有通往Internet网关的路由0.0.0.0/0
  • Lambda函数应配置为专用子网而不是公共子网
  • 在lambda函数中配置的安全组应允许出站到0.0.0.0/0(默认情况下存在,但您应进行验证)
  • NAT Gateway should always be in the public subnet.
  • Route table of Private Subnet should have a route 0.0.0.0/0 to NAT Gateway
  • Route table of Public Subnet should have a route 0.0.0.0/0 to Internet Gateway
  • Lambda function should be configured with the Private Subnet and not the Public Subnet
  • Security Group configured in the lambda function should allow outbound to 0.0.0.0/0 (which is there by default, but you should verify)

这篇关于邮件在VPC后面的Django AWS Lambda(Zappa)中无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆