- Newest
- Most votes
- Most comments
Based on your description, there are several potential causes for the timeout issue between your Lambda function and the internal Application Load Balancer (ALB).
Network ACLs could indeed be a factor. Unlike security groups, network ACLs are stateless and require explicit rules for both inbound and outbound traffic. You should verify that the subnet's network ACLs for both the Lambda function and the ALB allow the necessary inbound and outbound traffic on port 8000.
Another potential issue could be related to routing. Ensure there's a valid route path to the ALB in the route table. If the Lambda function and ALB are in the same VPC, check that there's a local route. If they're in different VPCs, make sure the route table has the appropriate route for VPC peering.
The timeout could also be related to the idle timeout configuration. When a Lambda function establishes a connection to an ALB, the ALB has a default idle timeout of 60 seconds. If your Lambda function takes longer to respond, the ALB might close the connection before the function completes its task.
Additionally, check if the Lambda function's execution timeout is sufficient. The default timeout for Lambda functions is 3 seconds, which might not be enough for your proxy operation.
For a more thorough analysis of network path configuration issues, you could use the VPC Reachability Analyzer to diagnose connectivity problems between your Lambda function and the ALB.
Since you mentioned that a direct integration from API Gateway to the ALB works, but the Lambda integration doesn't, it suggests that the issue is specific to the Lambda-to-ALB communication path. This reinforces the need to check network ACLs, routing, and security group configurations specifically for the Lambda function's subnets.
Sources
Troubleshoot ETIMEDOUT error in my Lambda function | AWS re:Post
Troubleshoot your Application Load Balancers - Elastic Load Balancing
ALB stops communicating with the lambda on the backend when the lambda is decoupled from the VPC. | AWS re:Post
Lambda Timeout Errors | AWS re:Post
Relevant content
asked 3 years ago
asked 3 years ago
