私下访问lambda

可以从vpc私有访问lambda吗? 假设我想从私有子网中的EC2服务器上运行的python代码调用lambda函数,是否可以不通过Internet调用它?

评论
  • mut
    mut 回复

    对我来说,这不是直接的方法。

    Lambda VPC integration is only for lambda to access VPC resources, not for VPC resources (e.g. ec2 instance in private subnet) to invoke lambda function. The reason is that Lambda invocation can come from only AWS Lambda API.

    Also since lambda does not have VPC endpoint, you can't call it from a private subnet without a NAT gateway.

  • Oo晓oO
    Oo晓oO 回复

    Yes you can, take a read at Lambda with VPC Networking.

    这样,将在您的VPC中指定的子网内创建一个ENI。此ENI将绑定到任何Lambda调用,以确保仅从这些VPC驻留网络传输。

    将其放入VPC后,您可以将其放在内部ALB后面,从而允许Python脚本与ALB进行交互,该交互将私下调用Lambda。