AWS Lambda Web Function with private VPC egress

Client → AWS Lambda Web Functions → Private resource

Run a Lambda Web Function that reaches private resources in your VPC through a Lambda network connector

This pattern deploys a Node.js HTTP server as an AWS Lambda Web Function with private egress into your VPC. An AWS::Serverless::NetworkConnector creates network interfaces in two of your subnets, and the function's revision references the connector's version-qualified ARN, so outbound calls go through your VPC.
The endpoint uses IamAuth, so only SigV4-signed requests reach the code. A revision that uses a network connector supports only HomeRegion endpoints.
The sample app can call an optional private URL, INTERNAL_TARGET_URL, and shows whether it was reachable through the VPC.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/lambda-web-vpc/nodejs/sam

Deploy

sam buildsam deploy --guided


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: sam delete. See the GitHub repo for removing the log groups.

Created by:

Shekhar Shrinivasan

Shekhar Shrinivasan

Senior Technical Consultant (TAM) at Amazon Web Services (AWS)