如何让 VPC 中的 AWS lambda 发布 SNS 通知?

如何让 VPC 中的 AWS lambda 发布 SNS 通知?

问题描述:

我有一个 lambda 函数,可以通过 VPC 访问 RDS 中的 Postgres 数据库.在查询数据库后,我想向 SNS 发布通知.因为我的 lambda 函数存在于我的 VPC 中,所以它无法访问 SNS.我的 VPC 上有一个 Internet 网关.我通读了 VPC 端点文档,目前仅支持 s3.

I have a lambda function that accesses my Postgres db in RDS via VPC. After it queries the db, I want to post a notification to SNS. Because my lambda function exists in my VPC, it cannot access SNS. I have an internet gateway on my VPC. I read through the VPC endpoint documentation and currently only s3 is supported.

无论如何要在 VPC 中的 lambda 函数中发布到 SNS?

Is there anyway to publish to SNS in a lambda function in a VPC?

您需要在 VPC 中运行 NAT 服务器来路由 VPC 外部的流量.AWS 现在提供 托管 NAT服务使这更容易.

You will need a NAT server running in your VPC to route traffic outside of the VPC. AWS now offers a managed NAT service that makes this easier.