Home > Software design >  Lambda function unable to access internet
Lambda function unable to access internet

Time:01-11

I would like my lambda function to be able to access the internet. I have followed the following AWS tutorial: nat created

Then I created a public-lambda network and created a route table that forwards default traffic to the NAT

subnet routing table

Then on my lambda function I have attached it to the public-lambda network

enter image description here

Inside my lambda function I make a request to a server out on the web. It just times out. I don't get logs on why it timed out but I'm assuming it wasn't able to reach the internet.

Why I'm not being able to access the internet from my lambda function?

CodePudding user response:

if your subnet has outbound access to internet(NAT/IGW) then definitely you lambda will get access to the internet.

first check with the subnet, try to spin one ec2 instance into that subnet and check the outbound connectivity using ping or curl.

second check the attached SG with lambda function.

just give a try, best of luck.

CodePudding user response:

After watching AWS: How to Place Your Lambda Functions in a VPC - YouTube I was able to fix my issue.

The fix was that I needed to create a private VPC and create a routing table to route all default traffic to the NAT.

  •  Tags:  
  • Related