Doc AWS SDK 예제 GitHub 리포지토리에서 더 많은 SDK 예제를 사용할 수 있습니다. AWS
기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.
를 사용한 Verified Permissions 예제 AWS CLI
다음 코드 예제에서는 Verified Permissions와 AWS Command Line Interface 함께를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.
작업은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 관련 시나리오의 컨텍스트에 따라 표시되며, 개별 서비스 함수를 직접적으로 호출하는 방법을 보여줍니다.
각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.
주제
작업
다음 코드 예시에서는 create-identity-source 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
자격 증명 소스를 생성하는 방법
다음
create-identity-source예시에서는 지정된 Amazon Cognito 사용자 풀에 저장된 자격 증명을 참조할 수 있는 자격 증명 소스를 생성합니다. 이러한 자격 증명은 Verified Permissions에서 유형의 엔터티로 사용할 수 있습니다User.aws verifiedpermissions create-identity-source \ --configurationfile://config.txt\ --principal-entity-type"User"\ --policy-store-idPSEXAMPLEabcdefg111111config.txt의 콘텐츠:{ "cognitoUserPoolConfiguration": { "userPoolArn": "arn:aws:cognito-idp:us-west-2:123456789012:userpool/us-west-2_1a2b3c4d5", "clientIds":["a1b2c3d4e5f6g7h8i9j0kalbmc"] } }출력:
{ "createdDate": "2023-05-19T20:30:28.214829+00:00", "identitySourceId": "ISEXAMPLEabcdefg111111", "lastUpdatedDate": "2023-05-19T20:30:28.214829+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111" }ID 소스에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateIdentitySource
를 참조하세요.
-
다음 코드 예시에서는 create-policy-store 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
정책 저장소 생성
다음
create-policy-store예시에서는 현재 AWS 리전에 정책 스토어를 생성합니다.aws verifiedpermissions create-policy-store \ --validation-settings"mode=STRICT"출력:
{ "arn": "arn:aws:verifiedpermissions::123456789012:policy-store/PSEXAMPLEabcdefg111111", "createdDate": "2023-05-16T17:41:29.103459+00:00", "lastUpdatedDate": "2023-05-16T17:41:29.103459+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111" }정책 저장소에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreatePolicyStore
를 참조하세요.
-
다음 코드 예시는 create-policy-template의 사용 방법을 보여 줍니다.
- AWS CLI
-
정책 템플릿을 생성하려면
다음 예에서는 보안 주체에 대한 자리 표시자가 있는 정책 템플릿을 생성합니다.
aws verifiedpermissions create-policy-template \ --statementfile://template1.txt\ --policy-store-idPSEXAMPLEabcdefg111111template1.txt의 콘텐츠:permit( principal in ?principal, action == Action::"view", resource == Photo::"VacationPhoto94.jpg" );출력:
{ "createdDate": "2023-06-12T20:47:42.804511+00:00", "lastUpdatedDate": "2023-06-12T20:47:42.804511+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111", "policyTemplateId": "PTEXAMPLEabcdefg111111" }정책 템플릿에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreatePolicyTemplate
을 참조하세요.
-
다음 코드 예시에서는 create-policy 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
예저 1: 정적 정책 생성
다음
create-policy예시에서는 보안 주체와 리소스를 모두 지정하는 정책 범위가 있는 정적 정책을 만듭니다.aws verifiedpermissions create-policy \ --definitionfile://definition1.txt\ --policy-store-idPSEXAMPLEabcdefg111111definition1.txt파일의 콘텐츠:{ "static": { "description": "Grant everyone of janeFriends UserGroup access to the vacationFolder Album", "statement": "permit(principal in UserGroup::\"janeFriends\", action, resource in Album::\"vacationFolder\" );" } }출력:
{ "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" } }예시 2: 모든 사용자에게 리소스에 대한 액세스 권한을 부여하는 정적 정책 생성
다음
create-policy예시에서는 리소스만 지정하는 정책 범위를 가진 정적 정책을 만듭니다.aws verifiedpermissions create-policy \ --definitionfile://definition2.txt\ --policy-store-idPSEXAMPLEabcdefg111111definition2.txt파일의 콘텐츠:{ "static": { "description": "Grant everyone access to the publicFolder Album", "statement": "permit(principal, action, resource in Album::\"publicFolder\");" } }출력:
{ "createdDate": "2023-06-12T20:39:44.975897+00:00", "lastUpdatedDate": "2023-06-12T20:39:44.975897+00:00", "policyId": "PbfR73F8oh5MMfr9uRtFDB", "policyStoreId": "PSEXAMPLEabcdefg222222", "policyType": "STATIC", "resource": { "entityId": "publicFolder", "entityType": "Album" } }예시 3: 지정된 템플릿과 연결된 템플릿 연결 정책 생성
다음
create-policy예시에서는 지정된 정책 템플릿을 사용하여 템플릿 연결 정책을 만들고 사용할 지정된 보안 주체를 새 템플릿 연결 정책과 연결합니다.aws verifiedpermissions create-policy \ --definitionfile://definition.txt\ --policy-store-idPSEXAMPLEabcdefg111111definition.txt의 콘텐츠:{ "templateLinked": { "policyTemplateId": "PTEXAMPLEabcdefg111111", "principal": { "entityType": "User", "entityId": "alice" } } }출력:
{ "createdDate": "2023-06-12T20:49:51.490211+00:00", "lastUpdatedDate": "2023-06-12T20:49:51.490211+00:00", "policyId": "TPEXAMPLEabcdefg111111", "policyStoreId": "PSEXAMPLEabcdefg111111", "policyType": "TEMPLATE_LINKED", "principal": { "entityId": "alice", "entityType": "User" }, "resource": { "entityId": "VacationPhoto94.jpg", "entityType": "Photo" } }정책에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreatePolicy
를 참조하세요.
-
다음 코드 예시에서는 delete-identity-source 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
자격 증명 소스 삭제
다음
delete-identity-source예시에서는 지정된 ID를 가진 ID 소스를 삭제합니다.aws verifiedpermissions delete-identity-source \ --identity-source-idISEXAMPLEabcdefg111111\ --policy-store-idPSEXAMPLEabcdefg111111이 명령은 출력을 생성하지 않습니다.
ID 소스에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteIdentitySource
를 참조하세요.
-
다음 코드 예시에서는 delete-policy-store 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
정책 저장소 삭제
다음
delete-policy-store예시에서는 지정된 ID를 가진 정책 저장소를 삭제합니다.aws verifiedpermissions delete-policy-store \ --policy-store-idPSEXAMPLEabcdefg111111이 명령은 출력을 생성하지 않습니다.
정책 저장소에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeletePolicyStore
를 참조하세요.
-
다음 코드 예시에서는 delete-policy-template 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
정책 작업 템플릿 삭제
다음
delete-policy-template예시에서는 지정된 ID가 있는 정책 템플릿을 삭제합니다.aws verifiedpermissions delete-policy \ --policy-template-idPTEXAMPLEabcdefg111111\ --policy-store-idPSEXAMPLEabcdefg111111이 명령은 출력을 생성하지 않습니다.
정책 템플릿에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeletePolicyTemplate
을 참조하세요.
-
다음 코드 예시에서는 delete-policy 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
정적 또는 템플릿 연결 정책 삭제
다음
delete-policy예시에서는 지정된 ID가 있는 정책을 삭제합니다.aws verifiedpermissions delete-policy \ --policy-idSPEXAMPLEabcdefg111111\ --policy-store-idPSEXAMPLEabcdefg111111이 명령은 출력을 생성하지 않습니다.
정책에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeletePolicy
를 참조하세요.
-
다음 코드 예시에서는 get-identity-source 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
자격 증명 소스에 대한 세부 정보 검색
다음
get-identity-source예시에서는 지정된 ID를 가진 ID 소스에 대한 세부 정보를 표시합니다.aws verifiedpermissions get-identity-source \ --identity-sourceISEXAMPLEabcdefg111111\ --policy-store-idPSEXAMPLEabcdefg111111출력:
{ "createdDate": "2023-06-12T22:27:49.150035+00:00", "details": { "clientIds": [ "a1b2c3d4e5f6g7h8i9j0kalbmc" ], "discoveryUrl": "https://cognito-idp.us-west-2.amazonaws.com/us-west-2_1a2b3c4d5", "openIdIssuer": "COGNITO", "userPoolArn": "arn:aws:cognito-idp:us-west-2:123456789012:userpool/us-west-2_1a2b3c4d5" }, "identitySourceId": "ISEXAMPLEabcdefg111111", "lastUpdatedDate": "2023-06-12T22:27:49.150035+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111", "principalEntityType": "User" }ID 소스에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetIdentitySource
를 참조하세요.
-
다음 코드 예시에서는 get-policy-store 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
정책 저장소 관련 세부 정보 검색
다음
get-policy-store예시에서는 지정된 ID를 가진 정책 저장소에 대한 세부 정보를 표시합니다.aws verifiedpermissions get-policy-store \ --policy-store-idPSEXAMPLEabcdefg111111출력:
{ "arn": "arn:aws:verifiedpermissions::123456789012:policy-store/PSEXAMPLEabcdefg111111", "createdDate": "2023-06-05T20:16:46.225598+00:00", "lastUpdatedDate": "2023-06-08T20:40:23.173691+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111", "validationSettings": { "mode": "OFF" } }정책 저장소에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetPolicyStore
를 참조하세요.
-
다음 코드 예시에서는 get-policy-template 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
정책 템플릿에 대한 세부 정보를 검색하는 방법
다음
get-policy-template예시에서는 지정된 ID를 가진 정책 템플릿에 대한 세부 정보를 표시합니다.aws verifiedpermissions get-policy-template \ --policy-template-idPTEXAMPLEabcdefg111111\ --policy-store-idPSEXAMPLEabcdefg111111출력:
{ "createdDate": "2023-06-12T20:47:42.804511+00:00", "lastUpdatedDate": "2023-06-12T20:47:42.804511+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111", "policyTemplateId": "PTEXAMPLEabcdefg111111", "statement": "permit(\n principal in ?principal,\n action == Action::\"view\",\n resource == Photo::\"VacationPhoto94.jpg\"\n);" }정책 템플릿에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetPolicyTemplate
을 참조하세요.
-
다음 코드 예시에서는 get-policy 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
정책 관련 세부 정보 검색
다음
get-policy예시에서는 지정된 ID를 가진 정책에 대한 세부 정보를 표시합니다.aws verifiedpermissions get-policy \ --policy-idPSEXAMPLEabcdefg111111\ --policy-store-idPSEXAMPLEabcdefg111111출력:
{ "createdDate": "2023-06-12T20:33:37.382907+00:00", "definition": { "static": { "description": "Grant everyone of janeFriends UserGroup access to the vacationFolder Album", "statement": "permit(principal in UserGroup::\"janeFriends\", action, resource in Album::\"vacationFolder\" );" } }, "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" } }정책에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetPolicy
를 참조하세요.
-
다음 코드 예시에서는 get-schema 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
정책 저장소에서 스키마 검색
다음
get-schema예시에서는 지정된 정책 저장소에 있는 스키마의 세부 정보를 표시합니다.aws verifiedpermissions get-schema \ --policy-store-idPSEXAMPLEabcdefg111111출력:
{ "policyStoreId": "PSEXAMPLEabcdefg111111", "schema": "{\"MySampleNamespace\":{\"entityTypes\":{\"Employee\":{\"shape\":{\"attributes\":{\"jobLevel\":{\"type\":\"Long\"},\"name\":{\"type\":\"String\"}},\"type\":\"Record\"}}},\"actions\":{\"remoteAccess\":{\"appliesTo\":{\"principalTypes\":[\"Employee\"]}}}}}", "createdDate": "2023-06-14T17:47:13.999885+00:00", "lastUpdatedDate": "2023-06-14T17:47:13.999885+00:00" }스키마에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 정책 저장소 스키마를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetSchema
를 참조하세요.
-
다음 코드 예시에서는 is-authorized-with-token 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
예시 1: 사용자 요청에 대한 권한 부여 결정을 요청하는 방법(허용)
다음
is-authorized-with-token예시에서는 Amazon Cognito로 인증된 사용자에 대한 권한 부여 결정을 요청합니다. 요청은 액세스 토큰이 아닌 Cognito에서 제공하는 자격 증명 토큰을 사용합니다. 이 예시에서는 지정된 정보 저장소가 보안 주체를CognitoUser유형의 엔터티로 반환하도록 구성됩니다.aws verifiedpermissions is-authorized-with-token \ --action actionId="View",actionType="Action" \ --resource entityId="vacationPhoto94.jpg",entityType="Photo" \ --policy-store-idPSEXAMPLEabcdefg111111\ --identity-token"AbCdE12345...long.string...54321EdCbA"정책 저장소에는 지정된 Cognito 사용자 풀 및 애플리케이션 Id의 ID를 허용하는 다음 문이 포함된 정책이 포함되어 있습니다.
permit( principal == CognitoUser::"us-east-1_1a2b3c4d5|a1b2c3d4e5f6g7h8i9j0kalbmc", action, resource == Photo::"VacationPhoto94.jpg" );출력:
{ "decision":"Allow", "determiningPolicies":[ { "determiningPolicyId":"SPEXAMPLEabcdefg111111" } ], "errors":[] }Cognito 사용자 풀의 ID를 사용하는 방법에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 ID 제공업체와 함께 Amazon Verified Permissions 사용을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 IsAuthorizedWithToken
을 참조하세요.
-
다음 코드 예시에서는 is-authorized 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
예시 1: 사용자 요청에 대한 권한 부여 결정을 요청하는 방법(허용)
다음
is-authorized예시는Photo유형의 리소스ㅡVacationPhoto94.jpg에 대해updatePhoto작업을 수행하려는User유형의 보안 주체,Alice에 대한 권한 부여 결정을 요청합니다.응답은 요청이 하나의 정책에 의해 허용되었음을 보여줍니다.
aws verifiedpermissions is-authorized \ --principalentityType=User,entityId=alice\ --actionactionType=Action,actionId=view\ --resourceentityType=Photo,entityId=VactionPhoto94.jpg\ --policy-store-idPSEXAMPLEabcdefg111111출력:
{ "decision": "ALLOW", "determiningPolicies": [ { "policyId": "SPEXAMPLEabcdefg111111" } ], "errors": [] }예시 2: 사용자 요청에 대한 권한 부여 결정을 요청하는 방법(거부)
다음 예시에서는 보안 주체가
User::"Bob"라는 점을 제외하고 이전 예시와 동일합니다. 정책 저장소에 해당 사용자가Album::"alice_folder"에 액세스할 수 있도록 허용하는 정책이 포함되어 있지 않습니다.출력은
DeterminingPolicies목록이 비어 있기 때문에Deny가 암시적임을 나타냅니다.aws verifiedpermissions create-policy \ --definitionfile://definition2.txt\ --policy-store-idPSEXAMPLEabcdefg111111출력:
{ "decision": "DENY", "determiningPolicies": [], "errors": [] }자세한 내용은 Amazon Verified Permissions 사용 설명서를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 IsAuthorized
를 참조하세요.
-
다음 코드 예시에서는 list-identity-sources 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용 가능한 자격 증명 소스를 나열하는 방법
다음
list-identity-sources예시에서는 지정된 정책 저장소의 모든 자격 증명 소스를 나열합니다.aws verifiedpermissions list-identity-sources \ --policy-store-idPSEXAMPLEabcdefg111111출력:
{ "identitySources": [ { "createdDate": "2023-06-12T22:27:49.150035+00:00", "details": { "clientIds": [ "a1b2c3d4e5f6g7h8i9j0kalbmc" ], "discoveryUrl": "https://cognito-idp.us-west-2.amazonaws.com/us-west-2_1a2b3c4d5", "openIdIssuer": "COGNITO", "userPoolArn": "arn:aws:cognito-idp:us-west-2:123456789012:userpool/us-west-2_1a2b3c4d5" }, "identitySourceId": "ISEXAMPLEabcdefg111111", "lastUpdatedDate": "2023-06-12T22:27:49.150035+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111", "principalEntityType": "User" } ] }ID 소스에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListIdentitySources
를 참조하세요.
-
다음 코드 예시에서는 list-policies 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용 가능한 정책을 나열하는 방법
다음
list-policies예시에서는 지정된 정책 저장소의 모든 정책을 나열합니다.aws verifiedpermissions list-policies \ --policy-store-idPSEXAMPLEabcdefg111111출력:
{ "policies": [ { "createdDate": "2023-06-12T20:33:37.382907+00:00", "definition": { "static": { "description": "Grant everyone of janeFriends UserGroup access to the vacationFolder Album" } }, "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" } }, { "createdDate": "2023-06-12T20:39:44.975897+00:00", "definition": { "static": { "description": "Grant everyone access to the publicFolder Album" } }, "lastUpdatedDate": "2023-06-12T20:39:44.975897+00:00", "policyId": "SPEXAMPLEabcdefg222222", "policyStoreId": "PSEXAMPLEabcdefg111111", "policyType": "STATIC", "resource": { "entityId": "publicFolder", "entityType": "Album" } }, { "createdDate": "2023-06-12T20:49:51.490211+00:00", "definition": { "templateLinked": { "policyTemplateId": "PTEXAMPLEabcdefg111111" } }, "lastUpdatedDate": "2023-06-12T20:49:51.490211+00:00", "policyId": "SPEXAMPLEabcdefg333333", "policyStoreId": "PSEXAMPLEabcdefg111111", "policyType": "TEMPLATE_LINKED", "principal": { "entityId": "alice", "entityType": "User" }, "resource": { "entityId": "VacationPhoto94.jpg", "entityType": "Photo" } } ] }정책에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListPolicies
를 참조하세요.
-
다음 코드 예시에서는 list-policy-stores 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용 가능한 정책 저장소 나열
다음
list-policy-stores예시에서는 AWS 리전의 모든 정책 스토어를 나열합니다. Verified Permissions에 대한 모든 명령 중create-policy-store및list-policy-stores를 제외한 모든 명령은 작업하려는 정책 저장소의 ID를 지정해야 합니다.aws verifiedpermissions list-policy-stores출력:
{ "policyStores": [ { "arn": "arn:aws:verifiedpermissions::123456789012:policy-store/PSEXAMPLEabcdefg111111", "createdDate": "2023-06-05T20:16:46.225598+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111" }, { "arn": "arn:aws:verifiedpermissions::123456789012:policy-store/PSEXAMPLEabcdefg222222", "createdDate": "2023-06-08T18:09:37.364356+00:00", "policyStoreId": "PSEXAMPLEabcdefg222222" }, { "arn": "arn:aws:verifiedpermissions::123456789012:policy-store/PSEXAMPLEabcdefg333333", "createdDate": "2023-06-08T18:09:46.920600+00:00", "policyStoreId": "PSEXAMPLEabcdefg333333" } ] }정책 저장소에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListPolicyStores
섹션을 참조하세요.
-
다음 코드 예시에서는 list-policy-templates 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용 가능한 정책 템플릿을 나열하는 방법
다음
list-policy-templates예시에서는 지정된 정책 저장소의 모든 정책 템플릿을 나열합니다.aws verifiedpermissions list-policy-templates \ --policy-store-idPSEXAMPLEabcdefg111111출력:
{ "policyTemplates": [ { "createdDate": "2023-06-12T20:47:42.804511+00:00", "lastUpdatedDate": "2023-06-12T20:47:42.804511+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111", "policyTemplateId": "PTEXAMPLEabcdefg111111" } ] }정책 템플릿에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListPolicyTemplates
를 참조하세요.
-
다음 코드 예시에서는 put-schema 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
정책 저장소에 저장
다음
put-schema예시에서는 지정된 정책 저장소의 스키마를 생성하거나 바꿉니다.입력 파일의
cedarJson파라미터는 JSON 객체를 문자열로 표현합니다. 가장 바깥쪽 따옴표 페어 안에 따옴표(")가 포함되어 있습니다. 이렇게 하려면 포함된 모든 따옴표 앞에 백슬래시 문자( “)를 붙이고 모든 줄을 줄 바꿈 없이 하나의 텍스트 줄로 결합하여 JSON을 문자열로 변환해야 합니다.가독성을 위해 여기에 여러 줄에 걸쳐 예시 문자열을 표시할 수 있지만, 작업을 수행하려면 파라미터를 단일 줄 문자열로 제출해야 합니다.
aws verifiedpermissions put-schema --definition file://schema.txt --policy-store-id PSEXAMPLEabcdefg111111
schema.txt의 콘텐츠:{ "cedarJson": "{\"MySampleNamespace\": {\"actions\": {\"remoteAccess\": { \"appliesTo\": {\"principalTypes\": [\"Employee\"]}}},\"entityTypes\": { \"Employee\": {\"shape\": {\"attributes\": {\"jobLevel\": {\"type\": \"Long\"},\"name\": {\"type\": \"String\"}},\"type\": \"Record\"}}}}}" }출력:
{ "policyStoreId": "PSEXAMPLEabcdefg111111", "namespaces": [ "MySampleNamespace" ], "createdDate": "2023-06-14T17:47:13.999885+00:00", "lastUpdatedDate": "2023-06-14T17:47:13.999885+00:00" }스키마에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 정책 저장소 스키마를 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 PutSchema
를 참조하세요.
-
다음 코드 예시에서는 update-identity-source 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
자격 증명 소스를 업데이트하는 방법
다음
update-identity-source예시에서는 새 Cognito 사용자 풀 구성을 제공하고 ID 소스에서 반환한 엔터티 유형을 변경하여 지정된 ID 소스를 수정합니다.aws verifiedpermissions update-identity-source --identity-source-idISEXAMPLEabcdefg111111\ --update-configurationfile://config.txt\ --principal-entity-type"Employee"\ --policy-store-idPSEXAMPLEabcdefg111111config.txt의 콘텐츠:{ "cognitoUserPoolConfiguration": { "userPoolArn": "arn:aws:cognito-idp:us-west-2:123456789012:userpool/us-west-2_1a2b3c4d5", "clientIds":["a1b2c3d4e5f6g7h8i9j0kalbmc"] } }출력:
{ "createdDate": "2023-05-19T20:30:28.214829+00:00", "identitySourceId": "ISEXAMPLEabcdefg111111", "lastUpdatedDate": "2023-05-19T20:30:28.214829+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111" }ID 소스에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateIdentitySource
를 참조하세요.
-
다음 코드 예시에서는 update-policy-store 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
정책 저장소 업데이트
다음
update-policy-store예시에서는 유효성 검사 설정을 변경하여 정책 저장소를 수정합니다.aws verifiedpermissions update-policy-store \ --validation-settings"mode=STRICT"\ --policy-store-idPSEXAMPLEabcdefg111111출력:
{ "arn": "arn:aws:verifiedpermissions::123456789012:policy-store/PSEXAMPLEabcdefg111111", "createdDate": "2023-05-16T17:41:29.103459+00:00", "lastUpdatedDate": "2023-05-16T17:41:29.103459+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111" }정책 저장소에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdatePolicyStore
를 참조하세요.
-
다음 코드 예시에서는 update-policy-template 코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
예시 1: 정책 템플릿 업데이트
다음
update-policy-template예시에서는 템플릿에 연결된 지정된 정책을 수정하여 정책 문을 바꿉니다.aws verifiedpermissions update-policy-template \ --policy-template-idPTEXAMPLEabcdefg111111\ --statementfile://template1.txt\ --policy-store-idPSEXAMPLEabcdefg111111template1.txt파일의 콘텐츠:permit( principal in ?principal, action == Action::"view", resource == Photo::"VacationPhoto94.jpg" );출력:
{ "createdDate": "2023-06-12T20:47:42.804511+00:00", "lastUpdatedDate": "2023-06-12T20:47:42.804511+00:00", "policyStoreId": "PSEXAMPLEabcdefg111111", "policyTemplateId": "PTEXAMPLEabcdefg111111" }정책 템플릿에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdatePolicyTemplate
을 참조하세요.
-
다음 코드 예시는 update-policy의 사용 방법을 보여 줍니다.
- AWS CLI
-
정적 정책을 생성하려면
다음
update-policy예제에서는 설명과 문을 업데이트하여 기존 정적 정책을 수정합니다.aws verifiedpermissions update-policy \ --policy-idSPEXAMPLEabcdefg111111\ --definitionfile://updated-definition.txt\ --policy-store-idPSEXAMPLEabcdefg111111statement파라미터는 JSON 객체를 문자열로 표현합니다. 가장 바깥쪽 따옴표 페어 안에 따옴표(")가 포함되어 있습니다. 이렇게 하려면 포함된 모든 따옴표 앞에 백슬래시 문자( “)를 붙이고 모든 줄을 줄 바꿈 없이 하나의 텍스트 줄로 결합하여 JSON을 문자열로 변환해야 합니다.가독성을 위해 여러 줄에 걸쳐 예제 문자열을 표시할 수 있지만, 해당 작업을 수행하려면 파라미터를 단일 줄 문자열로 제출해야 합니다.
updated-definition.txt파일의 콘텐츠:{ "static": { "description": "Updated policy to grant janeFriends UserGroup access to the vacationFolder Album with view action only", "statement": "permit(principal in UserGroup::\"janeFriends\", action == Action::\"view\", resource in Album::\"vacationFolder\" );" } }출력:
{ "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" } }정책에 대한 자세한 내용은 Amazon Verified Permissions 사용 설명서의 Amazon Verified Permissions 정책을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdatePolicy
를 참조하세요.
-