View a markdown version of this page

AgentCore VPC 設定で IAM 条件キーを使用する - Amazon Bedrock AgentCore

AgentCore VPC 設定で IAM 条件キーを使用する

VPC 設定に Amazon Bedrock AgentCore 固有の条件キーを使用して、AgentCore リソースのアクセス許可をより正確に制御します。たとえば、組織内のすべてのランタイムが VPC に接続されていることを要求したり、そのゲートウェイターゲットを承認済みサブネットにデプロイしたりします。ユーザーが使用できるサブネットとセキュリティグループ、および使用できないサブネットとセキュリティグループを指定します。

AgentCore は、IAM ポリシーで次の条件キーをサポートしています。

  • bedrock-agentcore:subnets – 1 つ以上のサブネットを許可または拒否します。

  • bedrock-agentcore:securityGroups – 1 つ以上のセキュリティグループを許可または拒否します。

次の AgentCore コントロールプレーン API オペレーションは、これらの条件キーをサポートしています。

  • AgentCore ランタイムと組み込みツールCreateAgentRuntimeUpdateAgentRuntimeCreateCodeInterpreter、および CreateBrowser

  • AgentCore GatewayCreateGatewayTargetおよび UpdateGatewayTarget (ターゲットのマネージド VPC リソースを設定する場合)

IAM ポリシーで条件キーを使用する方法の詳細については、IAM ユーザーガイドの「IAM JSON ポリシーエレメント: 条件」を参照してください。ゲートウェイ条件キーの詳細については、「Amazon Bedrock AgentCore Gateway で IAM 条件キーを使用する」を参照してください。

VPC 設定の条件キーを使用したポリシーの例

以下の例は、VPC 設定で条件キーを使用する方法を示しています。必要な制限を持つポリシーステートメントを作成し、ポリシーステートメントをターゲットユーザーまたはロールにアタッチします。

ユーザーが VPC に接続されたランタイムとツールのみをデプロイすることを要求する

すべてのユーザーが VPC に接続された AgentCore ランタイムツールと組み込みツールのみをデプロイすることを要求するには、有効なサブネットとセキュリティグループを含まないランタイムおよびツールの作成および更新オペレーションを拒否します。

{ "Sid": "EnforceVPCRuntime", "Action": [ "bedrock-agentcore:CreateAgentRuntime", "bedrock-agentcore:UpdateAgentRuntime", "bedrock-agentcore:CreateCodeInterpreter", "bedrock-agentcore:CreateBrowser" ], "Effect": "Deny", "Resource": "*", "Condition": { "Null": { "bedrock-agentcore:subnets": "true", "bedrock-agentcore:securityGroups": "true" } } }

ユーザーが特定のサブネットとセキュリティグループのみを使用するように強制する

ユーザーが特定の承認済みサブネットとセキュリティグループのみを使用するように強制するには、 で ForAnyValue set StringNotEquals 演算子を使用します。リクエスト内のコンテキストキー値のいずれかがポリシー内のコンテキストキー値と一致しない場合、条件は true を返します。未承認の値を含むリクエストは拒否されます。次の例では、ユーザーがサブネットsubnet-0123456789abcdef1には subnet-0123456789abcdef0と 、セキュリティグループsg-0123456789abcdef1には sg-0123456789abcdef0と のみを使用できるようにしています。

[ { "Sid": "DenyIfNotSpecificSubnets", "Effect": "Deny", "Action": [ "bedrock-agentcore:CreateAgentRuntime", "bedrock-agentcore:UpdateAgentRuntime", "bedrock-agentcore:CreateCodeInterpreter", "bedrock-agentcore:CreateBrowser" ], "Resource": "*", "Condition": { "ForAnyValue:StringNotEquals": { "bedrock-agentcore:subnets": ["subnet-0123456789abcdef0", "subnet-0123456789abcdef1"] } } }, { "Sid": "DenyIfNotSpecificSecurityGroups", "Effect": "Deny", "Action": [ "bedrock-agentcore:CreateAgentRuntime", "bedrock-agentcore:UpdateAgentRuntime", "bedrock-agentcore:CreateCodeInterpreter", "bedrock-agentcore:CreateBrowser" ], "Resource": "*", "Condition": { "ForAnyValue:StringNotEquals": { "bedrock-agentcore:securityGroups": ["sg-0123456789abcdef0", "sg-0123456789abcdef1"] } } } ]

特定のサブネットまたはセキュリティグループへのアクセスをユーザーに拒否する

特定のサブネットとセキュリティグループへのユーザーのアクセスを拒否するには、 で ForAnyValue set StringEquals 演算子を使用します。リクエスト内のコンテキストキー値のいずれかがポリシー内のコンテキストキー値のいずれかと一致する場合、条件は true を返します。次の例では、サブネットsubnet-0123456789abcdef1subnet-0123456789abcdef0および へのアクセス、セキュリティグループの sg-0123456789abcdef0および へのアクセスをユーザーに拒否sg-0123456789abcdef1します。

[ { "Sid": "EnforceOutOfSubnet", "Action": [ "bedrock-agentcore:CreateAgentRuntime", "bedrock-agentcore:UpdateAgentRuntime", "bedrock-agentcore:CreateCodeInterpreter", "bedrock-agentcore:CreateBrowser" ], "Effect": "Deny", "Resource": "*", "Condition": { "ForAnyValue:StringEquals": { "bedrock-agentcore:subnets": ["subnet-0123456789abcdef0", "subnet-0123456789abcdef1"] } } }, { "Sid": "EnforceOutOfSecurityGroups", "Action": [ "bedrock-agentcore:CreateAgentRuntime", "bedrock-agentcore:UpdateAgentRuntime", "bedrock-agentcore:CreateCodeInterpreter", "bedrock-agentcore:CreateBrowser" ], "Effect": "Deny", "Resource": "*", "Condition": { "ForAnyValue:StringEquals": { "bedrock-agentcore:securityGroups": ["sg-0123456789abcdef0", "sg-0123456789abcdef1"] } } } ]