Search code examples
amazon-web-servicesaws-lambdaamazon-vpc

Put lambda in VPC and subnet


I have lambda function which needs to access RDS in isolated private subnet.

And lambda function also need to access internet endpoint and be invoked from internet.

In this case,

  • put lambda in private subnet (with Nat gateway)

  • lambda can access internet from nat gateway

However ,,, is it possible to invoke lambda function in private subnet from internet?

(I can set API gateway to the lambda in private subnet?)


Solution

  • "However ,,, is it possible to invoke lambda function in private subnet from internet?"

    Yes, you always invoke Lambda from the AWS API, which is on the public Internet. Then AWS creates an instance of your Lambda function to handle the invocation. You never make a direct network connection to a Lambda function. It doesn't matter if your Lambda function is configured to run inside your VPC, you still invoke it the same way.