[英]AWS Lambda Timeout when Triggered through Cloudwatch
I have a lambda function that makes requests to external API which requires a static IP to whitelist.我有一个 lambda 函数,它向需要静态 IP 的外部 API 发出请求以将其列入白名单。 I have created a VPC with an assigned elastic IP to solve this.
我创建了一个分配了弹性 IP 的 VPC 来解决这个问题。
The function works perfectly when testing on the AWS Lambda console but if triggered using EventBridge (CloudWatch Events), it always times out:该函数在 AWS Lambda 控制台上测试时完美运行,但如果使用 EventBridge (CloudWatch Events) 触发,它总是超时:
2020-10-01T11:12:29.219Z 012df4ee-bb1e-4821-b1a2-6c3396ca760b Task timed out after 720.00 seconds
I thought the issue was the VPC, but considering this works when I manually trigger it I think there may be an issue with how the function is being triggered by cloudwatch.我认为问题出在 VPC 上,但考虑到当我手动触发它时这有效,我认为 Cloudwatch 如何触发该功能可能存在问题。
Has anyone had the problem before?有没有人遇到过这个问题?
It is not possible to assign an Elastic IP address to an AWS Lambda function.无法为 AWS Lambda 函数分配弹性 IP 地址。
Instead:反而:
The Lambda function will then access the Internet via the NAT Gateway/NAT Instance, using the assigned Elastic IP address.然后,Lambda 函数将使用分配的弹性 IP 地址通过 NAT 网关/NAT 实例访问 Internet。
See: Give Internet Access to a Lambda Function in a VPC请参阅: 为 VPC 中的 Lambda 函数提供 Internet 访问权限
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.