Mailing isn't working in Django AWS Lambda (Zappa) behind a VPC

和自甴很熟 提交于 2019-12-11 16:18:57

问题


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.

  • I created a NAT Gatway using one public subnet of the VPC.
  • Created another private subnet with a route table that routes 0.0.0.0/0 to the NAT Gateway.

I would appreciate any help.


回答1:


Go to VPC Dashboard and use the Launch VPC Dashboard

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

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.

Things to note:

  • 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)


来源:https://stackoverflow.com/questions/56571314/mailing-isnt-working-in-django-aws-lambda-zappa-behind-a-vpc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!