如何让 VPC 中的 Lambda 函数访问 Systems Manager Parameter Store?

1 分钟阅读
0

我在 Amazon Virtual Private Cloud (Amazon VPC) 中有一个 AWS Lambda 函数。 我想将函数连接到 AWS Systems Manager Parameter Store,但无法建立连接。为什么我的函数无法访问 Parameter Store,如何配置函数才能访问?

简短描述

Amazon VPC 中的 Lambda 函数没有访问互联网的权限。Lambda 在 Amazon VPC 内创建的网络接口具有私有 IP 地址,不能使用互联网网关访问互联网。此配置阻止函数访问 Amazon VPC 之外的其他 AWS 资源,例如 Parameter Store。

**注意:**最佳做法是不要将 Lambda 函数放在 Amazon VPC 中,除非该函数必须访问 VPC 中的其他资源。

解决方法

要允许 Amazon VPC 中的 Lambda 函数访问 Parameter Store,请执行下面任意一项操作:

注意:AWS PrivateLink VPC 终端节点依赖 DNS。如果您使用 AWS PrivateLink,请确保为您的 Amazon VPC 配置 DHCP 选项,以便为其设置 DNS。有关更多信息,请参阅在您的 VPC 中使用 DNS


相关信息

配置 Lambda 函数以访问 Amazon VPC 中的资源

VPC 终端节点

AWS 官方
AWS 官方已更新 2 年前