This repository contains example configuration for using a Lambda function inside a VPC. It also shows two different methods for using AWS services from a Lambda function in a VPC.
The two methods are:
- Using a NAT Gateway: Adding a NAT Gateway provides full public internet access to your Lambda function. A NAT Gateway costs ~$35 per month per instance plus data processing charges.
- Using a VPC Endpoint: A VPC endpoint allows you to use a specific AWS service from within a VPC. A VPC endpoint costs ~$7.50 per month plus data processing charges.
Check out the accompanying blog post on using AWS services from a Lambda inside a VPC for a larger breakdown of the pros and cons of the two approaches.