I have a Django project (Django 3.1.2) using fcm-django(version 0.3.7) to send push notifications. The application is deployed in AWS Elastic Beanstalk and the notifications are sent with no problems. I have the same code deployed in a AWS Lambda Function to run 3 cron jobs that check some conditions (each 15 minutes) and to send push notifications if necessary. But on the Lambda Function the notifications are not send. After some digging I understood that the function couldn't communicate with the outside because it was in a VPC. Which made absolute sense since I could see in the logs new HTTPS connections starting towards fcm.googleapis.com:443 and then "Task timed out after 30 seconds"
To give internet access to an Amazon VPC-connected Lambda function, we would need to route its outbound traffic to a NAT gateway in a public subnet.
So I followed the steps in How do I give internet access to a Lambda function that's connected to an Amazon VPC? to give internet access to the Lambda Function.
I added a call to http://dog-api.kinduff.com/api/ to my code. That call now goes through so the NAT configuration worked! However, I continue to have a timeout to fcm.googleapis.com...
What can it be? The Lambda Function has the same env variables as the app in Elastic Beanstalk.