View a markdown version of this page

搭配 Amazon Bedrock AgentCore Gateway 使用 IAM 條件金鑰 - Amazon Bedrock AgentCore

搭配 Amazon Bedrock AgentCore Gateway 使用 IAM 條件金鑰

使用 Amazon Bedrock AgentCore 特定條件金鑰來控制如何在組織中建立和設定閘道和閘道目標。這些條件索引鍵適用於控制平面操作。它們在服務控制政策 (SCPs中特別有用,以強制執行組織安全要求。

例如,您可以:

  • 要求所有閘道使用特定的身分提供者進行身分驗證。

  • 限制可以建立的目標類型。

  • 強制執行目標使用特定的登入資料提供者類型。

  • 要求閘道目標透過核准的子網路和安全群組進行連線。

閘道條件索引鍵

下列條件索引鍵適用於 CreateGatewayUpdateGateway操作。

條件鍵 Type API 操作 Description

bedrock-agentcore:DiscoveryUrl

String

CreateGateway, UpdateGateway

依閘道上設定的探索 URL 篩選存取權。使用此項目可確保閘道使用特定的身分提供者。

bedrock-agentcore:KmsKeyArn

String

CreateGateway, UpdateGateway

依用來加密閘道資源的 KMS 金鑰 ARN 篩選存取權。

bedrock-agentcore:PolicyEngineArn

String

CreateGateway, UpdateGateway

依與閘道相關聯之政策引擎組態的 ARN 篩選存取權。

bedrock-agentcore:PolicyEngineMode

String

CreateGateway, UpdateGateway

依與閘道相關聯的政策引擎組態模式篩選存取權。

bedrock-agentcore:ProtocolType

String

CreateGateway, UpdateGateway

依閘道的通訊協定類型篩選存取權。

bedrock-agentcore:GatewayAuthorizerType

String

CreateGateway, UpdateGateway

依閘道上設定的授權方類型篩選存取權。有效值為 AWS_IAMCUSTOM_JWTNONE

閘道目標條件索引鍵

下列條件索引鍵適用於 CreateGatewayTargetUpdateGatewayTarget操作。

條件鍵 Type API 操作 Description

bedrock-agentcore:McpTargetConfigurationType

String

CreateGatewayTarget, UpdateGatewayTarget

依 MCP 目標的類型篩選存取權。有效值包括 apiGatewaylambdamcpServeropenApiSchemasmithyModelconnector

bedrock-agentcore:HttpTargetConfigurationType

String

CreateGatewayTarget, UpdateGatewayTarget

依 HTTP 目標的類型篩選存取權。有效值包括 agentcoreRuntimepassthrough

bedrock-agentcore:InferenceTargetConfigurationType

String

CreateGatewayTarget, UpdateGatewayTarget

依推論目標的類型篩選存取權。有效值包括 connectorprovider

bedrock-agentcore:CredentialProviderType

String

CreateGatewayTarget, UpdateGatewayTarget

依目標上設定的登入資料提供者類型篩選存取權。有效值包括 GATEWAY_IAM_ROLEOAUTHAPI_KEYCALLER_IAM_CREDENTIALSJWT_PASSTHROUGH

bedrock-agentcore:PrivateEndpointType

String

CreateGatewayTarget, UpdateGatewayTarget

依目標的私有端點類型篩選存取權。有效值包括 managedVpcResourceselfManagedLatticeResource

bedrock-agentcore:ResourceConfigurationIdentifier

String

CreateGatewayTarget, UpdateGatewayTarget

依目標私有端點的資源組態識別符篩選存取權。

bedrock-agentcore:subnets

ArrayOfString

CreateGatewayTarget, UpdateGatewayTarget

依為目標的受管 VPC 資源設定的子網路篩選存取權。請參閱搭配 AgentCore VPC 設定使用 IAM 條件金鑰

bedrock-agentcore:securityGroups

ArrayOfString

CreateGatewayTarget, UpdateGatewayTarget

依針對目標的受管 VPC 資源設定的安全群組篩選存取權。

bedrock-agentcore:AllowedQueryParameters

ArrayOfString

CreateGatewayTarget, UpdateGatewayTarget

依目標中繼資料組態中允許的查詢參數篩選存取權。

bedrock-agentcore:AllowedRequestHeaders

ArrayOfString

CreateGatewayTarget, UpdateGatewayTarget

依目標中繼資料組態中允許的請求標頭篩選存取權。

bedrock-agentcore:AllowedResponseHeaders

ArrayOfString

CreateGatewayTarget, UpdateGatewayTarget

依目標中繼資料組態中允許的回應標頭篩選存取權。

bedrock-agentcore:CredentialProviderScope

ArrayOfString

CreateGatewayTarget, UpdateGatewayTarget

依目標的 OAuth 登入資料提供者上設定的範圍篩選存取權。

政策範例

下列範例示範如何在 IAM 政策和 SCPs 中使用條件金鑰,對閘道組態強制執行組織控制。

要求閘道使用特定的身分提供者

當閘道不使用您組織的核准身分提供者探索 URL 時,請使用下列 SCP 來拒絕閘道建立或更新。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "EnforceGatewayIdP", "Effect": "Deny", "Action": [ "bedrock-agentcore:CreateGateway", "bedrock-agentcore:UpdateGateway" ], "Resource": "*", "Condition": { "StringNotEquals": { "bedrock-agentcore:DiscoveryUrl": "https://login.example.com/.well-known/openid-configuration" } } } ] }

限制目標的登入資料提供者類型

使用下列 SCP 將閘道目標限制為核准的憑證提供者類型。在此範例中,您將閘道目標限制為僅使用閘道的 IAM 角色或呼叫者 IAM 憑證。目標無法使用外部受管 API 金鑰或 OAuth 權杖。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "RestrictTargetCredentialTypes", "Effect": "Deny", "Action": [ "bedrock-agentcore:CreateGatewayTarget", "bedrock-agentcore:UpdateGatewayTarget" ], "Resource": "*", "Condition": { "StringNotEquals": { "bedrock-agentcore:CredentialProviderType": [ "GATEWAY_IAM_ROLE", "CALLER_IAM_CREDENTIALS" ] } } } ] }

限制可建立的 MCP 目標類型

使用下列政策來拒絕建立使用特定組態類型的 MCP 目標。此範例可防止目標使用直接 MCP 伺服器 URLs。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "DenyDirectMcpServerTargets", "Effect": "Deny", "Action": [ "bedrock-agentcore:CreateGatewayTarget", "bedrock-agentcore:UpdateGatewayTarget" ], "Resource": "*", "Condition": { "StringEquals": { "bedrock-agentcore:McpTargetConfigurationType": "mcpServer" } } } ] }

要求目標使用私有端點

使用下列 SCP 來拒絕建立未指定私有端點類型的目標。這可確保所有目標流量都保留在私有網路中。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "EnforcePrivateEndpoints", "Effect": "Deny", "Action": [ "bedrock-agentcore:CreateGatewayTarget", "bedrock-agentcore:UpdateGatewayTarget" ], "Resource": "*", "Condition": { "Null": { "bedrock-agentcore:PrivateEndpointType": "true" } } } ] }

要求閘道使用客戶受管 KMS 金鑰

使用此 SCP 要求所有閘道使用客戶受管 KMS 金鑰進行加密,而不是使用服務預設值。

{ "Version": "2012-10-17", "Statement": [ { "Sid": "EnforceCustomerManagedKey", "Effect": "Deny", "Action": [ "bedrock-agentcore:CreateGateway", "bedrock-agentcore:UpdateGateway" ], "Resource": "*", "Condition": { "Null": { "bedrock-agentcore:KmsKeyArn": "true" } } } ] }

強制閘道目標的已核准子網路

使用下列政策將閘道目標限制為核准的子網路。如需詳細資訊,請參閱搭配 AgentCore VPC 設定使用 IAM 條件金鑰

{ "Version": "2012-10-17", "Statement": [ { "Sid": "EnforceApprovedSubnets", "Effect": "Deny", "Action": [ "bedrock-agentcore:CreateGatewayTarget", "bedrock-agentcore:UpdateGatewayTarget" ], "Resource": "*", "Condition": { "ForAnyValue:StringNotEquals": { "bedrock-agentcore:subnets": [ "subnet-0123456789abcdef0", "subnet-0123456789abcdef1" ] } } } ] }