View a markdown version of this page

连接到私人身份提供商 - Amazon Bedrock AgentCore
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)。

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

连接到私人身份提供商

Amazon Bedrock Id AgentCore entity 支持连接到托管在您的 Amazon VPC 内的 OAuth 2.0 身份提供商 (IdPs),例如自托管的 Keycloak 或其他 OIDC-compliant 授权服务器 PingFederate,而无需将其暴露在公共互联网上。这使您能够对 AgentCore 运行时和 AgentCore 网关 IdPs 的入站 JWT 授权以及出站 OAuth2 凭证提供商使用私有权限。

与托管 IdPs 的 VPC 的私有连接是使用 Amazon VPC Lattice 资源网关和资源配置建立的,其模式与AgentCore 网关 VPC 出口使用的模式相同。 AgentCore Identity 使用AWSServiceRoleForBedrockAgentCoreIdentity服务相关角色在您的账户中创建和管理 VPC Lattice 资源,以便与 IdP 终端节点建立私有连接。

重要

AgentCore 支持两种VPC Lattice连接模式——莱迪思管理模式(更简单, AgentCore 可处理资源生命周期)和自我管理的莱迪思(高级,具有跨账户支持和全面的监管可见性)。每种模式在复杂性、成本和控制方面都有不同的权衡取舍。有关优缺点的详细比较,请参阅支持的 VPC 出口模式。

使用案例

私有身份提供商在企业环境中很常见,在这些环境中,组织:

  • 在其 VPC 内运行自托管授权服务器,以满足合规性或数据驻留要求

  • 使用不可公开访问的私有 OIDC 发现端点

  • 要求所有身份验证流量在不穿越 Amazon 公共互联网的情况下留在网络内

使用私有 IdP 进行入站 JWT 授权

当您为 AgentCore Runtime 或 AgentCore Gateway 配置入站 JWT 授权时,授权者使用发现 URL 获取 IdP 的公钥 (JWKS) 并验证传入的 JWT 令牌。如果您的 IdP 托管在 VPC 内且发现 URL 不可公开访问,则必须配置私有终端节点,这样 Id AgentCore entity 才能访问 IdP 的 OIDC 发现和 JWKS 终端节点。

使用私有 IdP 配置入站授权

要使用私有 IdP 配置入站 JWT 授权,请在创建或更新 AgentCore 运行时或网关时将该privateEndpoint区块包含在授权方配置中。

示例: CreateAgentRuntime 使用私有 IdP 进行入站身份验证

{ "agentRuntimeName": "my-runtime", "authorizerConfiguration": { "customJWTAuthorizer": { "discoveryUrl": "https://idp.internal.example.com/.well-known/openid-configuration", "allowedAudiences": [ "my-agent-audience" ], "allowedClients": [ "my-client-id" ], "privateEndpoint": { "managedVpcResource": { "vpcIdentifier": "vpc-0abc123def456", "subnetIds": [ "subnet-0abc123", "subnet-0def456" ], "endpointIpAddressType": "IPV4", "securityGroupIds": [ "sg-0abc123def" ] } } } } }

示例: CreateGateway 使用私有 IdP 进行入站身份验证

{ "name": "my-gateway", "authorizerConfiguration": { "customJWTAuthorizer": { "discoveryUrl": "https://idp.internal.example.com/.well-known/openid-configuration", "allowedAudiences": [ "my-gateway-audience" ], "allowedClients": [ "my-client-id" ], "privateEndpoint": { "managedVpcResource": { "vpcIdentifier": "vpc-0abc123def456", "subnetIds": [ "subnet-0abc123", "subnet-0def456" ], "endpointIpAddressType": "IPV4", "securityGroupIds": [ "sg-0abc123def" ] } } } } }

如果您的 IdP 使用私有证书颁发机构颁发的 TLS 证书,则可以在其前面放置一个带有公有 ACM 证书的内部应用程序负载均衡器。有关更多信息,请参阅私有证书的解决方法:ALB 。

对于自行管理的莱迪思,请替换为managedVpcResource:selfManagedLatticeResource

示例: CreateAgentRuntime 使用自行管理的莱迪思进行入站身份验证

{ "agentRuntimeName": "my-runtime", "authorizerConfiguration": { "customJWTAuthorizer": { "discoveryUrl": "https://idp.internal.example.com/.well-known/openid-configuration", "allowedAudiences": [ "my-agent-audience" ], "allowedClients": [ "my-client-id" ], "privateEndpoint": { "selfManagedLatticeResource": { "resourceConfigurationIdentifier": "arn:aws:vpc-lattice:us-east-1:123456789012:resourceconfiguration/rcfg-abc123" } } } } }

示例: CreateGateway 使用自行管理的莱迪思进行入站身份验证

{ "name": "my-gateway", "authorizerConfiguration": { "customJWTAuthorizer": { "discoveryUrl": "https://idp.internal.example.com/.well-known/openid-configuration", "allowedAudiences": [ "my-gateway-audience" ], "allowedClients": [ "my-client-id" ], "privateEndpoint": { "selfManagedLatticeResource": { "resourceConfigurationIdentifier": "arn:aws:vpc-lattice:us-east-1:123456789012:resourceconfiguration/rcfg-abc123" } } } } }

具有私有 IdP 的出站 OAuth 凭证提供商

当您配置使用私有 IdP 的出站 OAuth2 凭证提供商时,Id AgentCore entity 需要到达 IdP 的令牌端点以交换访问令牌的授权码或执行客户端凭据授予。如果 IdP 的代币终端节点托管在您的 VPC 内,则必须在凭证提供商上配置私有终端节点。

使用私有 IdP 配置出站凭证提供商

要使用私有 IdP 配置出站 OAuth 凭证提供商,请在使用带有手动配置的自定义提供商创建凭据提供商时加入该privateEndpoint区块。

示例:使用私有 IdP 创建 OAuth 凭证提供商

{ "name": "my-private-idp-provider", "credentialProviderType": "OAUTH", "oauthCredentialProvider": { "providerType": "CUSTOM", "customProviderConfiguration": { "issuer": "https://idp.internal.example.com/realms/my-realm", "authorizationEndpoint": "https://idp.internal.example.com/realms/my-realm/protocol/openid-connect/auth", "tokenEndpoint": "https://idp.internal.example.com/realms/my-realm/protocol/openid-connect/token" }, "clientId": "my-client-id", "clientSecret": "my-client-secret", "privateEndpoint": { "managedVpcResource": { "vpcIdentifier": "vpc-0abc123def456", "subnetIds": [ "subnet-0abc123", "subnet-0def456" ], "endpointIpAddressType": "IPV4", "securityGroupIds": [ "sg-0abc123def" ] } } } }

对于自行管理的莱迪思,请替换为managedVpcResource:selfManagedLatticeResource

{ "name": "my-private-idp-provider", "credentialProviderType": "OAUTH", "oauthCredentialProvider": { "providerType": "CUSTOM", "customProviderConfiguration": { "issuer": "https://idp.internal.example.com/realms/my-realm", "authorizationEndpoint": "https://idp.internal.example.com/realms/my-realm/protocol/openid-connect/auth", "tokenEndpoint": "https://idp.internal.example.com/realms/my-realm/protocol/openid-connect/token" }, "clientId": "my-client-id", "clientSecret": "my-client-secret", "privateEndpoint": { "selfManagedLatticeResource": { "resourceConfigurationIdentifier": "arn:aws:vpc-lattice:us-east-1:123456789012:resourceconfiguration/rcfg-abc123" } } } }

先决条件

在配置私有身份提供商之前,请确保以下几点:

  • 您的身份提供商正在运行并在您的 VPC 中进行访问。

  • 可从指定的子网访问 IdP 的 OIDC 发现端点 (/.well-known/openid-configuration)、JWKS 端点和令牌端点。

  • 您的安全组允许您的 IdP 使用的端口(HTTPS 通常是端口 443)上的入站流量。

  • 对于托管莱迪思,您的IAM委托人必须具有iam:CreateServiceLinkedRole权限,这样 AgentCore 才能代表您创建身份网络服务相关角色。有关所需的 IAM 政策,请参阅身份网络服务相关角色。

  • 对于托管莱迪思,您的IAM委托人也需要以下Amazon EC2权限:ec2:CreateNetworkInterface

Service-linked 私人身份提供者的角色

当您为身份提供商配置私有终端节点时,Id AgentCore entity 使用AWSServiceRoleForBedrockAgentCoreIdentity服务相关角色来管理与您的 VPC 托管 IdP 的连接。此角色是在您首次为身份提供商配置托管私有终端节点时自动创建的,前提是您的 IAM 委托人具有所需的iam:CreateServiceLinkedRole权限。

有关创建、编辑和删除此角色的完整策略文档和说明,请参阅 I dentity Network 服务相关角色。

限制和注意事项

  • 发现 URL 必须为 HTTPS:IdP 的 OIDC 发现 URL 必须使用 HTTPS。不支持 HTTP 端点。

  • 私有证书:您的 IdP 必须使用公开信任的 TLS 证书,或者您必须在其前面放置带有公共 ACM 证书的 ALB。有关更多信息,请参阅私有证书的解决方法:ALB 。

  • Cross-account: Cross-account 私有 IdP 连接需要自管理的莱迪思选项。Managed Lattice不支持跨账户方案。

有关与 VPC Lattice 连接相关的其他限制,请参阅使用 VPC Lat tice 连接您的 VPC 中的私有资源中的限制和注意事项。