針對護欄使用資源型政策 - Amazon Bedrock

本文為英文版的機器翻譯版本,如內容有任何歧義或不一致之處,概以英文版為準。

針對護欄使用資源型政策

注意

針對 Amazon Bedrock Guardrails 使用資源型政策處於預覽狀態,可能會有所變更。

護欄支援護欄和護欄推論描述檔的資源型政策。資源型政策可讓您指定有權存取各項資源的人員,以及允許前述人員對各項資源執行的動作,藉此定義存取許可權限。

您可以將資源型政策 (RBP) 連接至 Guardrails 資源 (護欄或護欄推論設定檔)。在此政策中,您可以為可對這些資源執行特定動作的 Identity and Access Management (IAM) 主體指定許可。例如,連接到護欄的政策將包含套用護欄或讀取護欄組態的許可。

建議將資源型政策與帳戶層級強制執行的護欄搭配使用,且需要使用組織層級強制執行的護欄,因為對於組織強制執行的護欄,成員帳戶需要套用組織管理員帳戶中存在的護欄。若要在不同帳戶中使用護欄,發起人身分必須具有在護欄上呼叫 bedrock:ApplyGuardrail API 的許可,而且護欄必須連接以資源為基礎的政策,以授予該發起人許可。如需詳細資訊,請參閱跨帳戶政策評估邏輯身分型政策和資源型政策

RBPs 會從護欄詳細資訊頁面連接。如果護欄已啟用跨區域推論 (CRIS),發起人也必須擁有與該設定檔關聯之所有目的地區域guardrail-owner-account設定檔物件的ApplyGuardrail許可,而且 RBPs 必須依序連接到設定檔。如需詳細資訊,請參閱搭配 Amazon Bedrock 防護機制使用跨區域推論的許可。您可以從護欄儀表板上的「系統定義的護欄設定檔」區段,以及從該處連接的 RBPs,來存取設定檔詳細資訊頁面。

對於強制執行的護欄 (組織或帳戶層級),所有無權呼叫該護欄的 Bedrock Invoke 或 Converse APIs 發起人都會開始看到其呼叫失敗,但AccessDenied有例外。因此,強烈建議在建立組織或帳戶強制執行的護欄組態之前,檢查您是否能夠在護欄上從其將強制執行的帳戶中的身分呼叫 ApplyGuardrail API。

護欄和護欄設定檔資源型政策允許的政策語言目前受到限制,且僅支援一組有限的政策陳述式。

支援的政策陳述式模式

在您自己的帳戶中共用護欄

account-id 必須是包含護欄的帳戶。

護欄的政策:

JSON
{ "Version":"2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::111122223333:root" }, "Action": [ "bedrock:ApplyGuardrail", "bedrock:GetGuardrail" ], "Resource": "arn:aws:bedrock:us-east-1:111122223333:guardrail/guardrail-id" }] }
護欄設定檔的政策:

JSON
{ "Version":"2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::111122223333:root" }, "Action": [ "bedrock:ApplyGuardrail" ], "Resource": "arn:aws:bedrock:us-east-1:111122223333:guardrail-profile/profile-id" }] }

與您的組織共用護欄

account-id 必須符合您要從中連接 RBP 的帳戶,且該帳戶必須位於 中org-id

護欄的政策:

JSON
{ "Version":"2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": "*", "Action": [ "bedrock:GetGuardrail", "bedrock:ApplyGuardrail" ], "Resource": "arn:aws:bedrock:us-east-1:111122223333:guardrail/guardrail-id", "Condition": { "StringEquals": { "aws:PrincipalOrgID": "org-id" } } }] }
護欄設定檔的政策:

JSON
{ "Version":"2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": "*", "Action": [ "bedrock:ApplyGuardrail" ], "Resource": "arn:aws:bedrock:us-east-1:111122223333:guardrail-profile/profile-id", "Condition": { "StringEquals": { "aws:PrincipalOrgID": "org-id" } } }] }

與特定 OUs 共用護欄

account-id 必須符合您要從中連接 RBP 的帳戶,且該帳戶必須位於 中org-id

護欄的政策:

JSON
{ "Version":"2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": "*", "Action": [ "bedrock:ApplyGuardrail", "bedrock:GetGuardrail" ], "Resource": "arn:aws:bedrock:us-east-1:111122223333:guardrail/guardrail-id", "Condition": { "ForAnyValue:StringLike": { "aws:PrincipalOrgPaths": [ "org-id/*/org-unit-id/*" ] } } }] }
護欄設定檔的政策:

JSON
{ "Version":"2012-10-17", "Statement": [{ "Effect": "Allow", "Principal": "*", "Action": [ "bedrock:ApplyGuardrail" ], "Resource": "arn:aws:bedrock:us-east-1:111122223333:guardrail-profile/profile-id", "Condition": { "ForAnyValue:StringLike": { "aws:PrincipalOrgPaths": [ "org-id/*/org-unit-id/*" ] } } }] }

不支援的功能

護欄不支援在組織外部共用。

護欄不支援具有上述 PrincipalOrgId或 上所列條件以外的條件的 RBPsPrincipalOrgPaths

護欄不支援在沒有組織或組織單位條件的情況下使用*委託人。

護欄僅支援 RBPs 中的 bedrock:ApplyGuardrailbedrock:GetGuardrail動作。對於 guardrail-profile 資源,僅支援 ApplyGuardrail