Knowledge Center Monthly Newsletter - March 2025
Stay up to date with the latest from the Knowledge Center. See all new and updated Knowledge Center articles published in the last month and re:Post’s top contributors.
我想为 AWS Lambda 函数分配一个静态 IP 地址。
请按照以下步骤为 Lambda 函数分配静态 IP 地址。
配置 Lambda 函数以连接到 Amazon VPC。向 Lambda 函数分配一个带有私有 IP 地址的弹性网络接口 (ENI)。不能将 Lambda 弹性网络接口私有 IP 地址假定为静态 IP 地址,因为该 IP 地址在弹性网络接口生命周期中发生了变化。
有关更多信息,请参阅配置 Lambda 函数以访问 VPC 中的资源。
**请注意:**除非函数必须访问 Amazon VPC 中的其他资源,否则最佳做法是不将 Lambda 函数放置在 Amazon VPC 中。
从私有子网访问互联网需要网络地址转换 (NAT)。若要为连接到 Amazon VPC 的 Lambda 函数提供互联网访问权限,请将其出站流量路由到公有子网中的 NAT 网关或 NAT 实例。确保 NAT 网关或 NAT 实例有通往互联网网关的路由。
有关更多信息,请参阅如何为连接到 Amazon VPC 的 Lambda 函数提供互联网访问权限?
将弹性 IP 地址与公有 NAT 网关或实例相关联。NAT 网关或实例会将实例的源 IP 地址替换为弹性 IP 地址。可以假定此弹性 IP 地址是 Lambda 函数的静态 IP 地址。
请注意:
使用互联网网关连接到互联网
为连接到 VPC 的函数接入互联网和服务