gistmax. Back to DiscoverStudio
Technology

Restore internet access for a Lambda function attached to a VPC

By Gistmax Tutorials · 2026-11-04

AWS: Restore internet access for a Lambda function attached to a VPC. Workflow: identify, diagnose, fix, verify.
AWS: Restore internet access for a Lambda function attached to a VPC. Workflow: identify, diagnose, fix, verify.

A Lambda function reaches a private database after being attached to a VPC but can no longer call an external HTTPS service. The external request eventually times out.

Why this happens

VPC attachment changes the network path. Placing a function in a public subnet does not automatically give it a public IP or internet connectivity.

Step-by-step solution

1. Identify the selected subnets, route tables and security groups. Trace the intended outbound path to the destination.

2. For internet access, use the supported routing design, such as private subnets with a suitable NAT path. For AWS services, evaluate an appropriate VPC endpoint where applicable.

3. Check DNS resolution, outbound rules and network ACLs. Review infrastructure cost and availability before adding network resources.

Worked example

A function that only needs S3 may be able to use an appropriate endpoint instead of general internet egress. A third-party API still needs a route that can reach that external service.

Verify the fix

Test DNS and a bounded HTTPS request from the function, then test the private database again. Both paths should work without opening unnecessary inbound access.

Prevent a repeat

Document why each function needs VPC access and manage routing as infrastructure code. Avoid assuming that public subnet means public IP.

Reference

Official documentation or standards guidance

An original Gistmax troubleshooting guide. Scenarios and sample values are illustrative; configuration depends on your software version and environment. Cover diagram: Gistmax Tutorials.

Join the conversation →