I have 2 lambda functions that are in the same VPC. I want one to call the other, but it always times out. I understand that you cant make requests outside of the vpc, but these are in the same region on the same vpc.
I did follow the instructions in the answer for AWS lambda invoke not calling another lambda function - Node.js , but it doesnt seem to have made a difference.
I created a new VPC, created 2 subnets (named one public and the other private), created an internet gateway, created a NAT gateway using the public subnet and a new elastic IP, and added the routing tables as described in the stackoverflow answer. It doesnt seem to help.
If I disassociate both lambda functions with the VPC is works fine, so I know that the VPC is at least related to my issue.
To be clear, I dont fully understand how all of this works. When you associate a VPC with a Lambda function, I need to include 1 or more subnets. Should both lambda function use both subnets? Should 1 use the private and the other the public? Does it even matter?
I am using the default Security Group, which I believe allows all Inbound and Outbound communication. Is there an obvious answer that I am not seeing? Is there a way to debug this, such as logging traffic to and from the VPC?
Thanks
UPDATE As requested, here are the default security group rules that have been applied:
UPDATE 2 Since it has come up a few times, I haved create a NAT Gateway.
- Both Lambda functions are in the same VPC.
- I have a Private Subnet that is attached to my NAT Gateway with an Elastic IP
- I have a Public Subnet that is Routed to my Internet Gateway
- Both Lambda Function include both the Public and Private Subnets in their configuration
All but the last list item were done following the instructions in the SO question I have linked to. Including the public and private subnets in the Lambda function configuration is more a product of me not knowing exactly how it should be configured. Let me know if there is any additiona information I should inlcude.