Connect 连接到私人身份提供商
Amazon Bedrock Id AgentCore entity 支持连接到托管在您的 VP AWS C 内的 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莱迪思连接模式——莱迪思托管(更简单, AgentCore 处理资源生命周期)和自我管理的莱迪思(高级,具有跨账户支持和完全的监管可见性)。每种模式在复杂性、成本和控制方面都有不同的权衡取舍。有关优缺点的详细比较,请参阅支持的 VPC 出口模式。
使用案例
私有身份提供商在企业环境中很常见,在这种环境中,组织:
-
在其 VPC 内运行自托管授权服务器,以满足合规性或数据驻留要求
-
使用不可公开访问的私有 OIDC 发现端点
-
要求所有身份验证流量保持在 AWS 网络内而不必通过公共互联网
使用私有 IdP 进行入站 JWT 授权
当您为 AgentCore Runtime 或 AgentCore Gateway 配置入站 JWT 授权时,授权方使用发现 URL 获取 IdP 的公钥 (JWKS) 并验证传入的 JWT 令牌。如果您的 IdP 托管在 VPC 内且发现 URL 不可公开访问,则必须配置私有终端节点,以便 AgentCore 身份可以访问 IdP 的 OIDC 发现和 JWKS 终端节点。
使用私有 IdP 配置入站授权
要使用私有 IdP 配置入站 JWT 授权,请在创建或更新privateEndpoint AgentCore 运行时或网关时将该区块包含在授权方配置中。
示例: 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 证书的内部 Application Load Balancer。有关更多信息,请参阅私有证书的解决方法:ALB。
对于自我管理的莱迪思,请替换为managedVpcResource:selfManagedLatticeResource
示例: CreateAgentRuntime 使用自我管理的 Lattice 进行入站身份验证
{ "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 使用自我管理的 Lattice 进行入站身份验证
{ "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 凭证提供程序时, AgentCore 身份需要到达 IdP 的令牌端点才能将授权码交换为访问令牌或执行客户端凭证授予。如果 IdP 的令牌终端节点托管在您的 VPC 内,则必须在凭证提供程序上配置私有终端节点。
使用私有 IdP 配置出站凭证提供商
要为出站 OAuth 凭证提供者配置私有 IdP,请在使用带有手动配置的自定义提供者创建凭据提供程序时加入该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委托人必须拥有 AgentCore 代表您创建身份网络服务相关角色的
iam:CreateServiceLinkedRole权限。有关所需的 IAM 策略,请参阅身份网络服务相关角色。 -
对于托管莱迪思,您的IAM委托人也需要以下Amazon EC2权限:
ec2:CreateNetworkInterface
Service-linked 私人身份提供商的角色
当您为身份提供商配置私有终端节点时,Ident AgentCore ity 会使用AWSServiceRoleForBedrockAgentCoreIdentity服务相关角色来管理与您的 VPC 托管 IdP 的连接。如果您的 IAM 委托人具有所需的iam:CreateServiceLinkedRole权限,则会在您首次为身份提供商配置托管私有终端节点时自动创建此角色。
有关创建、编辑和删除此角色的完整策略文档和说明,请参阅 Ident ity Network 服务相关角色。
限制和注意事项
-
发现网址必须是 HTTPS:IdP 的 OIDC 发现网址必须使用 HTTPS。不支持 HTTP 端点。
-
私有证书:您的 IdP 必须使用公开信任的 TLS 证书,或者您必须在其前面放置一个带有公共 ACM 证书的 ALB。有关更多信息,请参阅私有证书的解决方法:ALB。
-
Cross-account: Cross-account 私有IdP连接需要莱迪思的自我管理选项。托管莱迪思不支持跨账户方案。
有关与 VPC Lattice 连接相关的其他限制,请参阅使用 VPC Lattice 连接到 VPC 中的私有资源中的限制和注意事项。