选择您的 Cookie 首选项

我们使用必要 Cookie 和类似工具提供我们的网站和服务。我们使用性能 Cookie 收集匿名统计数据,以便我们可以了解客户如何使用我们的网站并进行改进。必要 Cookie 无法停用,但您可以单击“自定义”或“拒绝”来拒绝性能 Cookie。

如果您同意,AWS 和经批准的第三方还将使用 Cookie 提供有用的网站功能、记住您的首选项并显示相关内容,包括相关广告。要接受或拒绝所有非必要 Cookie,请单击“接受”或“拒绝”。要做出更详细的选择,请单击“自定义”。

AWSSupport-TroubleshootLambdaInternetAccess - AWS Systems Manager 自动化运行手册参考

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

AWSSupport-TroubleshootLambdaInternetAccess

描述

AWSSupport-TroubleshootLambdaInternetAccess运行手册可帮助您解决在亚马逊虚拟私有云(Amazon VPC)中启动的 AWS Lambda 功能的互联网访问问题。对子网路由、安全组规则和网络访问控制列表 (ACL) 规则等资源进行审查,以确认允许出站互联网访问。

运行此自动化(控制台)

文档类型

自动化

所有者

Amazon

平台

Linux,macOS, Windows

参数

  • AutomationAssumeRole

    类型:字符串

    描述:(可选)允许 Systems Manager Automation 代表您执行操作 AWS Identity and Access Management (IAM) 角色的 Amazon 资源名称(ARN)。如果未指定角色,Systems Manager Automation 将使用启动此运行手册的用户的权限。

  • FunctionName

    类型:字符串

    描述:(必需)要为其排除互联网访问问题的 Lambda 函数的名称。

  • destinationIp

    类型:字符串

    描述:(必需)要与之建立出站连接的目标 IP 地址。

  • destinationPort

    类型:字符串

    默认值:443

    描述:(可选)要在其上建立出站连接的目标端口。

所需的 IAM 权限

AutomationAssumeRole 参数需要执行以下操作才能成功使用运行手册。

  • lambda:GetFunction

  • ec2:DescribeRouteTables

  • ec2:DescribeNatGateways

  • ec2:DescribeSecurityGroups

  • ec2:DescribeNetworkAcls

文档步骤

  • aws:executeScript - 验证启动 Lambda 函数的 VPC 中各种资源的配置。

  • aws:branch - 根据指定的 Lambda 函数是否在 VPC 中进行分支。

  • aws:executeScript - 查看其中启动 Lambda 函数的子网的路由表路由,并验证是否存在到网络地址转换 (NAT) 网关和互联网网关的路由。确认 Lambda 函数不在公有子网中。

  • aws:executeScript - 根据为 destinationIpdestinationPort 参数指定的值,验证与 Lambda 函数关联的安全组是否允许出站互联网访问。

  • aws:executeScript - 根据为 destinationIpdestinationPort 参数指定的值,验证与 Lambda 函数子网关联的 ACL 规则和 NAT 网关是否允许出站互联网访问。

输出

checkVpc.vpc - Lambda 函数启动所在 VPC 的 ID。

checkvpc.Subnet-启动您 IDs 的 Lambda 函数的子网。

checkVpc.securityGroups - 与 Lambda 函数关联的安全组。

checkNACL.NACL - 带有资源名称的分析消息。LambdaIp 指 Lambda 函数的弹性网络接口的私有 IP 地址。LambdaIpRules 对象仅对具有通往 NAT 网关的路由的子网生成。以下内容为输出示例。

{ "subnet-1234567890":{ "NACL":"acl-1234567890", "destinationIp_Egress":"Allowed", "destinationIp_Ingress":"notAllowed", "Analysis":"This NACL has an allow rule for Egress traffic but there is no Ingress rule. Please allow the destination IP / destionation port in Ingress rule", "LambdaIpRules":{ "{LambdaIp}":{ "Egress":"notAllowed", "Ingress":"notAllowed", "Analysis":"This is a NAT subnet NACL. It does not have ingress or egress rule allowed in it for Lambda's corresponding private ip {LambdaIp} Please allow this IP in your egress and ingress NACL rules" } } }, "subnet-0987654321":{ "NACL":"acl-0987654321", "destinationIp_Egress":"Allowed", "destinationIp_Ingress":"notAllowed", "Analysis":"This NACL has an allow rule for Egress traffic but there is no Ingress rule. Please allow the destination IP / destionation port in Ingress rule" } }

checkSecurityGroups.secgrps-分析与您的 Lambda 函数关联的安全组。以下内容为输出示例。

{ "sg-123456789":{ "Status":"Allowed", "Analysis":"This security group has allowed destintion IP and port in its outbuond rule." } }

checkSubnet.subnets - 对 VPC 中与 Lambda 函数关联的子网的分析。以下内容为输出示例。

{ "subnet-0c4ee6cdexample15":{ "Route":{ "DestinationCidrBlock":"8.8.8.0/26", "NatGatewayId":"nat-00f0example69fdec", "Origin":"CreateRoute", "State":"active" }, "Analysis":"This Route Table has an active NAT gateway path. Also, The NAT gateway is launched in public subnet", "RouteTable":"rtb-0b1fexample16961b" } }
隐私网站条款Cookie 首选项
© 2025, Amazon Web Services, Inc. 或其附属公司。保留所有权利。