'aws lambda cannot make a http call
I'm trying to make a simple http request from a lambda function. But for some reason any request does not seem to go through. Does the lambda environment block any request. The lambda is on a No VPC configuration.
I did a bit of research on this and found the following
https://forums.aws.amazon.com/thread.jspa?messageID=731223
But this is really beyond my comprehension on subnets. But from what I understand here if its not on any VPC it should make the call successfully?
Solution 1:[1]
Lambda doesn't block any network requests but since the ENI attached to the Lambda doesn't have a public IP address any public REST API call will fail.
The solution to that is to route the traffic to a NAT Gateway/instance from the subnet the Lambda is in. That NAT would then reside in a subnet that has a default route to an internet gateway.
If the Lambda function's code does not need to access a private resource in the VPC you should remove it. Having a Lambda in a VPC only complicates executions by increasing cold start time and ensuring there's enough IPs in the subnets for the ENIs to assume. Here is a doc about Lambda in a VPC.
https://docs.aws.amazon.com/lambda/latest/dg/best-practices.html#lambda-vpc
Hth
-James
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jmp |
