정적 정책을 편집하려면
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"
}
}