静的ポリシーを編集するには
UpdatePolicy オペレーションを使用して静的ポリシーを編集できます。次の例では、単純な静的ポリシーを編集します。
この例では、definition.txtファイルを使用してポリシー定義を格納しています。
{
"static": {
"description": "Grant everyone of janeFriends UserGroup access to the vacationFolder Album",
"statement": "permit(principal in UserGroup::\"janeFriends\", action, resource in Album::\"vacationFolder\" );"
}
}
以下のコマンドはそのファイルを参照します。
$ aws verifiedpermissions create-policy \
--definition file://definition.txt \
--policy-store-id PSEXAMPLEabcdefg111111
{
"createdDate": "2023-06-12T20:33:37.382907+00:00",
"lastUpdatedDate": "2023-06-12T20:33:37.382907+00:00",
"policyId": "SPEXAMPLEabcdefg111111",
"policyStoreId": "PSEXAMPLEabcdefg111111",
"policyType": "STATIC",
"principal": {
"entityId": "janeFriends",
"entityType": "UserGroup"
},
"resource": {
"entityId": "vacationFolder",
"entityType": "Album"
}
}
ポリシーの名前を更新するには
ポリシーを更新するときに、ポリシー名を設定または更新できます。名前は、ポリシーストア内のすべてのポリシーで一意で、プレフィックスが である必要がありますname/。更新リクエストに名前フィールドを含めない場合、既存の名前は変更されません。名前を削除するには、空の文字列に設定します。
$ aws verifiedpermissions update-policy \
--policy-id SPEXAMPLEabcdefg111111 \
--policy-store-id PSEXAMPLEabcdefg111111 \
--definition file://definition.txt \
--name name/example-policy
{
"createdDate": "2023-06-12T20:33:37.382907+00:00",
"lastUpdatedDate": "2023-06-12T20:47:42.804511+00:00",
"policyId": "SPEXAMPLEabcdefg111111",
"policyStoreId": "PSEXAMPLEabcdefg111111",
"policyType": "STATIC",
"principal": {
"entityId": "janeFriends",
"entityType": "UserGroup"
},
"resource": {
"entityId": "vacationFolder",
"entityType": "Album"
}
}