正在连接到私有 APIs 中 EventBridge - Amazon EventBridge

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

正在连接到私有 APIs 中 EventBridge

您可以创建与私有 HTTPS 端点的连接,以提供对内部 VPCs 或本地资源的安全 point-to-point网络访问,而不必穿越公共互联网。例如,您可以创建一个连接,用于访问 Amazon Elastic Load Balancer 后端基于 HTTPS 的应用程序。

EventBridge 利用在 VPC Lattice 中创建的资源配置创建与私有 HTTPS 终端节点的连接。资源配置是一个逻辑对象,用于标识资源,并指定可访问该资源的对象及访问方式。要在中创建与私有 API 的连接 EventBridge,您需要为私有 API 指定资源配置。有关更多信息,请参阅《Amazon VPC Lattice 用户指南》中的 VPC Lattice 中的资源配置

EventBridge 然后创建允许 EventBridge 访问私有 API 的资源关联。有关更多信息,请参阅《Amazon VPC Lattice 用户指南》中的管理资源关联

在 EventBridge 管理资源关联的同时,它会使用您的证书创建关联,因此您可以查看资源关联操作。

EventBridge 和 Step Functions 使用连接作为 HTTPS 端点的授权配置。

您可以创建 APIs 在其他 AWS 账户中使用私有访问权限的连接。有关更多信息,请参阅 跨账户私密账户 APIs

连接私有版的权限 APIs

以下策略示例包括创建私有 API 连接所需的最低权限。

JSON
{ "Version":"2012-10-17", "Statement": [ { "Action": [ "vpc-lattice:CreateServiceNetworkResourceAssociation", "vpc-lattice:GetResourceConfiguration", "vpc-lattice:AssociateViaAWSService-EventsAndStates", "events:CreateConnection" ], "Resource": [ "*" ], "Effect": "Allow" } ] }

以下策略示例包括更新私有 API 连接所需的最低权限。

JSON
{ "Version":"2012-10-17", "Statement": [ { "Action": [ "vpc-lattice:CreateServiceNetworkResourceAssociation", "vpc-lattice:GetResourceConfiguration", "vpc-lattice:AssociateViaAWSService-EventsAndStates", "events:UpdateConnection" ], "Resource": [ "*" ], "Effect": "Allow" } ] }

监控私有连接的创建情况 APIs

当您创建与私有 API 的连接时,会生成以下日志:

在创建连接的账户中, AWS CloudTrail 会记录一个 CreateServiceNetworkResourceAssociation 事件。

在此日志中sourceIPAddressuserAgent、和设置serviceNetworkIdentifier为 EventBridge 服务主体events.amazonaws.com

{ "eventTime": "2024-11-21T00:00:00Z", "eventSource": "vpc-lattice.amazonaws.com", "eventName": "CreateServiceNetworkResourceAssociation", "awsRegion": "region", "sourceIPAddress": "events.amazonaws.com", "userAgent": "events.amazonaws.com", "requestParameters": { "x-amzn-vpc-lattice-association-source-arn": "***", "x-amzn-vpc-lattice-service-network-identifier": "***", "clientToken": "token", "serviceNetworkIdentifier": "events.amazonaws.com", "resourceConfigurationIdentifier": "arn:partition:vpc-lattice:region:account-id:resourceconfiguration/resource-configuration-id", "tags": { "ManagedByServiceAWSEventBridge": "account-id:connection-name" } }

在包含私有 API 的账户中, AWS CloudTrail 记录一个CreateServiceNetworkResourceAssociationBySharee事件。

此日志包含:

  • callerAccountId: 创建连接的 AWS 账户

  • accountId:包含私有 API 的 AWS 账户。

  • resource-configuration-arn:私有 API 的 VPC Lattice 资源配置。

{ "eventTime": "2024-11-21T06:31:42Z", "eventSource": "vpc-lattice.amazonaws.com", "eventName": "CreateServiceNetworkResourceAssociationBySharee", "awsRegion": "region", "sourceIPAddress": "vpc-lattice.amazonaws.com", "userAgent": "user-agent", "additionalEventData": { "callerAccountId": "consumer-account-id" }, "resources": [ { "accountId": "provider-account-id", "type": "AWS::VpcLattice::ServiceNetworkResourceAssociation", "ARN": "resource-configuration-arn" } ] }

如果跨账户连接到私有账户 APIs,则包含该连接的账户将不会收到用于调用私有 API AWS CloudTrail 的 VPC Lattice 日志。

管理连接的服务网络资源关联

当您为要连接的私有 API 指定 VPC 莱迪思资源配置时,通过在 VPC 莱迪思资源配置和服务拥有的 VPC 莱迪思服务网络之间创建资源关联来 EventBridge 启用连接。 EventBridge 在 EventBridge 管理资源关联的同时,它会使用您的证书创建关联,因此您可以保持对资源关联的可见性。这意味着您可以列出和描述资源关联。

使用 d escribe- connection 返回连接描述,其中包括资源配置和资源关联的 Amazon 资源名称 (ARNs)。

您无法删除由创建的资源关联 EventBridge。如果删除连接,则 EventBridge 会删除所有相应的资源关联。

有关更多信息,请参阅《Amazon VPC Lattice 用户指南》中的管理资源关联

连接到本地私有网络 APIs

通过 AWS PrivateLink 和 VPC Lattice 访问 VPC 资源,您可以连接到本地私有网络。 APIs为此,您必须在 VPC 和本地环境之间配置网络路由。例如,您可以使用 AWS Direct ConnectAWS Site-to-Site VPN 来建立此类路由。