쿠키 기본 설정 선택

당사는 사이트와 서비스를 제공하는 데 필요한 필수 쿠키 및 유사한 도구를 사용합니다. 고객이 사이트를 어떻게 사용하는지 파악하고 개선할 수 있도록 성능 쿠키를 사용해 익명의 통계를 수집합니다. 필수 쿠키는 비활성화할 수 없지만 '사용자 지정' 또는 ‘거부’를 클릭하여 성능 쿠키를 거부할 수 있습니다.

사용자가 동의하는 경우 AWS와 승인된 제3자도 쿠키를 사용하여 유용한 사이트 기능을 제공하고, 사용자의 기본 설정을 기억하고, 관련 광고를 비롯한 관련 콘텐츠를 표시합니다. 필수가 아닌 모든 쿠키를 수락하거나 거부하려면 ‘수락’ 또는 ‘거부’를 클릭하세요. 더 자세한 내용을 선택하려면 ‘사용자 정의’를 클릭하세요.

AWS CLI를 사용한 Amazon Cognito ID 예제

포커스 모드
AWS CLI를 사용한 Amazon Cognito ID 예제 - AWS Command Line Interface

이 문서는 AWS CLI의 버전 1에만 해당합니다. AWS CLI의 버전 2와 관련된 문서는 버전 2 사용 설명서를 참조하세요.

이 문서는 AWS CLI의 버전 1에만 해당합니다. AWS CLI의 버전 2와 관련된 문서는 버전 2 사용 설명서를 참조하세요.

다음 코드 예제에서는 Amazon Cognito 자격 증명에서 AWS Command Line Interface를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여 줍니다.

작업은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 관련 시나리오의 컨텍스트에 따라 표시되며, 개별 서비스 함수를 직접적으로 호출하는 방법을 보여줍니다.

각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.

주제

작업

다음 코드 예시에서는 create-identity-pool을 사용하는 방법을 보여 줍니다.

AWS CLI

Cognito 자격 증명 풀 공급자를 사용하여 자격 증명 풀 생성

이 예시에서는 MyIdentityPool이라는 자격 증명 풀을 생성합니다. Cognito 자격 증명 풀 공급자가 있습니다. 인증되지 않은 자격 증명은 허용되지 않습니다.

명령:

aws cognito-identity create-identity-pool --identity-pool-name MyIdentityPool --no-allow-unauthenticated-identities --cognito-identity-providers ProviderName="cognito-idp.us-west-2.amazonaws.com/us-west-2_aaaaaaaaa",ClientId="3n4b5urk1ft4fl3mg5e62d9ado",ServerSideTokenCheck=false

출력:

{ "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "IdentityPoolName": "MyIdentityPool", "AllowUnauthenticatedIdentities": false, "CognitoIdentityProviders": [ { "ProviderName": "cognito-idp.us-west-2.amazonaws.com/us-west-2_111111111", "ClientId": "3n4b5urk1ft4fl3mg5e62d9ado", "ServerSideTokenCheck": false } ] }

다음 코드 예시에서는 create-identity-pool을 사용하는 방법을 보여 줍니다.

AWS CLI

Cognito 자격 증명 풀 공급자를 사용하여 자격 증명 풀 생성

이 예시에서는 MyIdentityPool이라는 자격 증명 풀을 생성합니다. Cognito 자격 증명 풀 공급자가 있습니다. 인증되지 않은 자격 증명은 허용되지 않습니다.

명령:

aws cognito-identity create-identity-pool --identity-pool-name MyIdentityPool --no-allow-unauthenticated-identities --cognito-identity-providers ProviderName="cognito-idp.us-west-2.amazonaws.com/us-west-2_aaaaaaaaa",ClientId="3n4b5urk1ft4fl3mg5e62d9ado",ServerSideTokenCheck=false

출력:

{ "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "IdentityPoolName": "MyIdentityPool", "AllowUnauthenticatedIdentities": false, "CognitoIdentityProviders": [ { "ProviderName": "cognito-idp.us-west-2.amazonaws.com/us-west-2_111111111", "ClientId": "3n4b5urk1ft4fl3mg5e62d9ado", "ServerSideTokenCheck": false } ] }

다음 코드 예시에서는 delete-identities을 사용하는 방법을 보여 줍니다.

AWS CLI

ID 풀 삭제

이 예제에서는 ID 풀을 삭제합니다.

명령:

aws cognito-identity delete-identity-pool --identity-ids-to-delete "us-west-2:11111111-1111-1111-1111-111111111111"

출력:

{ "UnprocessedIdentityIds": [] }
  • API 세부 정보는 AWS CLI 명령 참조DeleteIdentities를 참조하세요.

다음 코드 예시에서는 delete-identities을 사용하는 방법을 보여 줍니다.

AWS CLI

ID 풀 삭제

이 예제에서는 ID 풀을 삭제합니다.

명령:

aws cognito-identity delete-identity-pool --identity-ids-to-delete "us-west-2:11111111-1111-1111-1111-111111111111"

출력:

{ "UnprocessedIdentityIds": [] }
  • API 세부 정보는 AWS CLI 명령 참조DeleteIdentities를 참조하세요.

다음 코드 예시에서는 delete-identity-pool을 사용하는 방법을 보여 줍니다.

AWS CLI

ID 풀 삭제

다음 delete-identity-pool 예시에서는 지정된 자격 증명 풀을 삭제합니다.

명령:

aws cognito-identity delete-identity-pool \ --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111"

이 명령은 출력을 생성하지 않습니다.

다음 코드 예시에서는 delete-identity-pool을 사용하는 방법을 보여 줍니다.

AWS CLI

ID 풀 삭제

다음 delete-identity-pool 예시에서는 지정된 자격 증명 풀을 삭제합니다.

명령:

aws cognito-identity delete-identity-pool \ --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111"

이 명령은 출력을 생성하지 않습니다.

다음 코드 예시에서는 describe-identity-pool을 사용하는 방법을 보여 줍니다.

AWS CLI

자격 증명 풀을 설명하는 방법

이 예제에서는 자격 증명 풀을 설명합니다.

명령:

aws cognito-identity describe-identity-pool --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111"

출력:

{ "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "IdentityPoolName": "MyIdentityPool", "AllowUnauthenticatedIdentities": false, "CognitoIdentityProviders": [ { "ProviderName": "cognito-idp.us-west-2.amazonaws.com/us-west-2_111111111", "ClientId": "3n4b5urk1ft4fl3mg5e62d9ado", "ServerSideTokenCheck": false } ] }

다음 코드 예시에서는 describe-identity-pool을 사용하는 방법을 보여 줍니다.

AWS CLI

자격 증명 풀을 설명하는 방법

이 예제에서는 자격 증명 풀을 설명합니다.

명령:

aws cognito-identity describe-identity-pool --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111"

출력:

{ "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "IdentityPoolName": "MyIdentityPool", "AllowUnauthenticatedIdentities": false, "CognitoIdentityProviders": [ { "ProviderName": "cognito-idp.us-west-2.amazonaws.com/us-west-2_111111111", "ClientId": "3n4b5urk1ft4fl3mg5e62d9ado", "ServerSideTokenCheck": false } ] }

다음 코드 예시에서는 get-identity-pool-roles을 사용하는 방법을 보여 줍니다.

AWS CLI

자격 증명 풀 역할을 가져오는 방법

이 예제에서는 자격 증명 풀이 나열되어 있습니다.

명령:

aws cognito-identity get-identity-pool-roles --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111"

출력:

{ "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "Roles": { "authenticated": "arn:aws:iam::111111111111:role/Cognito_MyIdentityPoolAuth_Role", "unauthenticated": "arn:aws:iam::111111111111:role/Cognito_MyIdentityPoolUnauth_Role" } }

다음 코드 예시에서는 get-identity-pool-roles을 사용하는 방법을 보여 줍니다.

AWS CLI

자격 증명 풀 역할을 가져오는 방법

이 예제에서는 자격 증명 풀이 나열되어 있습니다.

명령:

aws cognito-identity get-identity-pool-roles --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111"

출력:

{ "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "Roles": { "authenticated": "arn:aws:iam::111111111111:role/Cognito_MyIdentityPoolAuth_Role", "unauthenticated": "arn:aws:iam::111111111111:role/Cognito_MyIdentityPoolUnauth_Role" } }

다음 코드 예시에서는 list-identity-pools을 사용하는 방법을 보여 줍니다.

AWS CLI

ID 풀 나열

이 예시에는 자격 증명 풀이 나열되어 있습니다. 최대 20개의 자격 증명이 나열되어 있습니다.

명령:

aws cognito-identity list-identity-pools --max-results 20

출력:

{ "IdentityPools": [ { "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "IdentityPoolName": "MyIdentityPool" }, { "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "IdentityPoolName": "AnotherIdentityPool" }, { "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "IdentityPoolName": "IdentityPoolRegionA" } ] }
  • API 세부 정보는 AWS CLI 명령 참조의 ListIdentityPools 섹션을 참조하세요.

다음 코드 예시에서는 list-identity-pools을 사용하는 방법을 보여 줍니다.

AWS CLI

ID 풀 나열

이 예시에는 자격 증명 풀이 나열되어 있습니다. 최대 20개의 자격 증명이 나열되어 있습니다.

명령:

aws cognito-identity list-identity-pools --max-results 20

출력:

{ "IdentityPools": [ { "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "IdentityPoolName": "MyIdentityPool" }, { "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "IdentityPoolName": "AnotherIdentityPool" }, { "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "IdentityPoolName": "IdentityPoolRegionA" } ] }
  • API 세부 정보는 AWS CLI 명령 참조의 ListIdentityPools 섹션을 참조하세요.

다음 코드 예시에서는 set-identity-pool-roles을 사용하는 방법을 보여 줍니다.

AWS CLI

자격 증명 풀 역할을 설정하는 방법

다음 set-identity-pool-roles 예제에서는 자격 증명 풀의 역할을 설정합니다.

aws cognito-identity set-identity-pool-roles \ --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111" \ --roles authenticated="arn:aws:iam::111111111111:role/Cognito_MyIdentityPoolAuth_Role"

다음 코드 예시에서는 set-identity-pool-roles을 사용하는 방법을 보여 줍니다.

AWS CLI

자격 증명 풀 역할을 설정하는 방법

다음 set-identity-pool-roles 예제에서는 자격 증명 풀의 역할을 설정합니다.

aws cognito-identity set-identity-pool-roles \ --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111" \ --roles authenticated="arn:aws:iam::111111111111:role/Cognito_MyIdentityPoolAuth_Role"

다음 코드 예시에서는 update-identity-pool을 사용하는 방법을 보여 줍니다.

AWS CLI

자격 증명 풀을 생성하는 방법

이 예제에서는 자격 증명 풀을 업데이트합니다. 이름을 MyIdentityPool로 설정합니다. 자격 증명 공급자로 Cognito를 추가합니다. 인증되지 않은 자격 증명은 허용되지 않습니다.

명령:

aws cognito-identity update-identity-pool --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111" --identity-pool-name "MyIdentityPool" --no-allow-unauthenticated-identities --cognito-identity-providers ProviderName="cognito-idp.us-west-2.amazonaws.com/us-west-2_111111111",ClientId="3n4b5urk1ft4fl3mg5e62d9ado",ServerSideTokenCheck=false

출력:

{ "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "IdentityPoolName": "MyIdentityPool", "AllowUnauthenticatedIdentities": false, "CognitoIdentityProviders": [ { "ProviderName": "cognito-idp.us-west-2.amazonaws.com/us-west-2_111111111", "ClientId": "3n4b5urk1ft4fl3mg5e62d9ado", "ServerSideTokenCheck": false } ] }
  • API 세부 정보는 AWS CLI 명령 참조의 UpdateIdentityPool 섹션을 참조하세요.

다음 코드 예시에서는 update-identity-pool을 사용하는 방법을 보여 줍니다.

AWS CLI

자격 증명 풀을 생성하는 방법

이 예제에서는 자격 증명 풀을 업데이트합니다. 이름을 MyIdentityPool로 설정합니다. 자격 증명 공급자로 Cognito를 추가합니다. 인증되지 않은 자격 증명은 허용되지 않습니다.

명령:

aws cognito-identity update-identity-pool --identity-pool-id "us-west-2:11111111-1111-1111-1111-111111111111" --identity-pool-name "MyIdentityPool" --no-allow-unauthenticated-identities --cognito-identity-providers ProviderName="cognito-idp.us-west-2.amazonaws.com/us-west-2_111111111",ClientId="3n4b5urk1ft4fl3mg5e62d9ado",ServerSideTokenCheck=false

출력:

{ "IdentityPoolId": "us-west-2:11111111-1111-1111-1111-111111111111", "IdentityPoolName": "MyIdentityPool", "AllowUnauthenticatedIdentities": false, "CognitoIdentityProviders": [ { "ProviderName": "cognito-idp.us-west-2.amazonaws.com/us-west-2_111111111", "ClientId": "3n4b5urk1ft4fl3mg5e62d9ado", "ServerSideTokenCheck": false } ] }
  • API 세부 정보는 AWS CLI 명령 참조의 UpdateIdentityPool 섹션을 참조하세요.

이 페이지에서

프라이버시사이트 이용 약관쿠키 기본 설정
© 2025, Amazon Web Services, Inc. 또는 계열사. All rights reserved.