enabling-lambda-vpc-internet-access

enabling-lambda-vpc-internet-access

熱門

透過建立 NAT Gateway 基礎設施、設定公用/私人子網路路由,並更新安全群組,讓部署在 VPC 子網路中的 AWS Lambda 函式可以存取網際網路。當 VPC 中的 Lambda 函式無法連線到網際網路時使用。

2184星標
207分支
更新於 2026/7/30
SKILL.md
readonlyread-only
name
enabling-lambda-vpc-internet-access
description

Enables internet access for AWS Lambda functions deployed in VPC subnets by creating NAT Gateway infrastructure, configuring public/private subnet routing, and updating security groups. Use when a VPC-attached Lambda function cannot reach the internet.

version
1

啟用 Lambda VPC 網際網路存取

概觀

此領域專業知識用於啟用 VPC 私人子網路中 AWS Lambda 函式的網際網路存取。VPC 中的 Lambda 函式無法取得公用 IP 位址,因此對外網際網路存取需要 NAT Gateway 基礎設施,將流量從私人子網路透過公用子網路路由至網際網路閘道。

為 VPC Lambda 函式啟用網際網路存取

若要設定 NAT Gateway 基礎設施並為需要網際網路存取的 Lambda 函式設定路由,請確實依照程序執行。
請參閱 Lambda VPC 網際網路存取設定程序

疑難排解

NAT Gateway 無法運作

確認與 Lambda 子網路關聯的路由表具有指向 NAT Gateway 的 0.0.0.0/0 路由。詳細資訊請參閱完整程序。

Lambda 函式逾時

檢查安全群組的對外規則是否允許必要的連接埠,並確認 NAT Gateway 和網際網路閘道都已正確設定。

網路變更未生效

VPC 網路變更可能需要 1–2 分鐘才會生效。建立 NAT Gateway 或更新路由表後,請等待一段時間再進行測試。

路由表關聯問題

確認 Lambda 函式的子網路已關聯到具有指向 NAT Gateway 之 0.0.0.0/0 路由的路由表。