1
votes

I have a beautiful Lambda setup with Cloudwatch Events triggering the functions on a schedule.

I am starting to move my Lambda functions into VPC, but I am having a dickens of a time getting Cloudwatch Events to properly trigger Lambda functions. They continually time out.

Is there a way to use CW Events to trigger VPC Lambda functions? If not, is there a canonical solution to triggering Lambda functions on schedule?

1

1 Answers

1
votes

This issue isn't related to Cloudwatch Events. The source of the function trigger doesn't modify how Lambda actually invokes the function.

The problem is almost certainly that your functions don't currently work inside your VPC, and this in turn because you have not configured the VPC as needed for Internet access -- and most of the various AWS service APIs are accessed via an Internet connection. A NAT device is required, because your Lambda containers have only private IP addresses.

Important

If your Lambda function needs Internet access, do not attach it to a public subnet or to a private subnet without Internet access. Instead, attach it only to private subnets with Internet access through a NAT instance or an Amazon VPC NAT gateway.

http://docs.aws.amazon.com/lambda/latest/dg/vpc.html

The functions will otherwise time out the first time and any time your code attempts to access any resource outside the VPC.