I am calling a remote https url using python requests inside aws lambda in python, which fails with:
Failed to establish a new connection: [Errno -2] Name or service not known
But I know the DNS for https url is fine because I can access the URL from all other environments outside AWS Lambda, including my local machine. It even works fine from an EC2 instance running inside the same VPC.
I believe the DNS settings were recently changed/fixed but it seems like the old values may be cached somewhere so the lambda function is using the old broken DNS.
Is there a way to clear this?
I already forced the Lambda functions to be restated (by changing the memory allocation) so I am confident is is not actually cached inside the lambda function - it must be cleared at a different level, such as inside the VPC/Subnet/etc?