View a markdown version of this page

在中连接到私有 API EventBridge - Amazon EventBridge
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

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

在中连接到私有 API EventBridge

您可以创建与私有 HTTPS 端点的连接,以提供对 VPC 或本地资源的安全点对点网络访问,而无需经由公共互联网。例如,您可以创建连接以访问 Amazon Elastic Load Balancer 背后的 HTTPS-based 应用程序。

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

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

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

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

您可以创建访问其他Amazon账户中的私有 API 的连接。有关更多信息,请参阅 Cross-account 私有 API

连接私有 API 的权限

以下策略示例包括创建私有 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" } ] }

监控私有 API 连接的创建

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

在创建连接的账户中,Amazon 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 的账户中,Amazon CloudTrail记录一个CreateServiceNetworkResourceAssociationBySharee事件。

此日志包含:

  • callerAccountId: 创建连接时使用的Amazon账户

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

  • 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" } ] }

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

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

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

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

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

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

连接到本地私有 API

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