Home > Blockchain >  Connecting to Lambda service using ec2 inside a private subnet
Connecting to Lambda service using ec2 inside a private subnet

Time:04-04

I am trying to run the command “aws lambda list-functions” from an ec2 inside my private subnet that I connected to using a bastion host. The lambda has been deployed to the same VPC and private subnet, but when I try to run the command it times out. They are in the same region, and I have been able to connect to some of my other services within this ec2 but can’t connect to my lambda service endpoint.

I tried connecting from an ec2 inside a public subnet and that worked fine, but can't connect from ec2 inside the private subnet.

CodePudding user response:

You have two options for that:

  1. Setup NAT gateway in a public subnet along with route tables entries directly internet traffic in a private subnet to the NAT.
  2. Setup VPC interface endpoint for lambda so that you can connect to the lambda service without needing internet connectivity.
  • Related