I am lifting up a preprod environment with CloudFormation. I have already an staging environment that works properly. I have an AWS Lambda function that is located inside a VPC and that, at some point, sends a message to an SQS queue.
Currently this lambda function is timing out. In staging it is working correctly. If I configure the wrong sqs queue in staging, I got an access denied exception (the sqs access is configured in the lambda role). If I do the same with my preprod Lambda, it just times out.
I have reviewed the following questions:
- Sending a message to AWS SQS Queue with AWS Lambda Python API Times out
- AWS Lambda times out when trying to connect to sqs
- AWS Lambda connection to SQS timed out
Most of them contain answers pointing out the known issue that Lambdas within a VPC have no internet access. I have a NAT gateway properly configured. I even added some debug code to both staging and preprod lambdas to make an http request to https://httpbin.org/get and both succeeded, so the internet access seems not to be the problem.
I am not using VPC SQS Endpoints but just the public SQS URL. The last thing I tried was to use the AWS Reachability Analyzer but I have not figured out yet how to create a path that goes from my VPC to the public sqs url.
Any advice will be appreciated.