이 문서는 AWS CLI의 버전 1에만 해당합니다. AWS CLI의 버전 2와 관련된 문서는 버전 2 사용 설명서를 참조하세요.
AWS CLI를 사용한 Amazon Cognito 자격 증명 공급자 예시
다음 코드 예는 Amazon Cognito 자격 증명 공급자와 함께 AWS Command Line Interface를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.
작업은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 개별 서비스 함수를 직접적으로 호출하는 방법을 보여주며 관련 시나리오의 컨텍스트에 맞는 작업을 볼 수 있습니다.
각 예시에는 컨텍스트에서 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있는 전체 소스 코드에 대한 링크가 포함되어 있습니다.
주제
작업
다음 코드 예시에서는 add-custom-attributes
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 지정 속성 추가
이 예시에서는 사용자 지정 속성 CustomAttr1을 사용자 풀에 추가합니다. 문자열 유형이며 최소 1자에서 최대 15자까지 입력해야 합니다. 이 값은 필수가 아닙니다.
명령:
aws cognito-idp add-custom-attributes --user-pool-id
us-west-2_aaaaaaaaa
--custom-attributes Name="CustomAttr1",AttributeDataType="String",DeveloperOnlyAttribute=false,Required=false,StringAttributeConstraints="{MinLength=1,MaxLength=15}"-
API 세부 정보는 AWS CLI 명령 참조의 AddCustomAttributes
섹션을 참조하세요.
-
다음 코드 예시에서는 admim-disable-user
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 비활성화
이 예시에서는 사용자 jane@example.com을 비활성화합니다.
명령:
aws cognito-idp admin-disable-user --user-pool-id
us-west-2_aaaaaaaaa
--usernamejane@example.com
-
API 세부 정보는 AWS CLI 명령 참조의 AdmimDisableUser
섹션을 참조하세요.
-
다음 코드 예시에서는 admim-enable-user
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 활성화
이 예시에서는 사용자 이름 jane@example.com을 활성화합니다.
명령:
aws cognito-idp admin-enable-user --user-pool-id
us-west-2_aaaaaaaaa
--usernamejane@example.com
-
API 세부 정보는 AWS CLI 명령 참조의 AdmimEnableUser
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-add-user-to-group
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
그룹에 사용자 추가
이 예시에서는 사용자 Jane을 MyGroup 그룹에 추가합니다.
명령:
aws cognito-idp admin-add-user-to-group --user-pool-id
us-west-2_aaaaaaaaa
--usernameJane
--group-nameMyGroup
-
API 세부 정보는 AWS CLI 명령 참조의 AdminAddUserToGroup
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-confirm-sign-up
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 등록을 확인하는 방법
이 예시에서는 사용자 jane@example.com을 확인합니다.
명령:
aws cognito-idp admin-confirm-sign-up --user-pool-id
us-west-2_aaaaaaaaa
--usernamejane@example.com
-
API 세부 정보는 AWS CLI 명령 참조의 AdminConfirmSignUp
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-create-user
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 생성
다음
admin-create-user
예시에서는 지정된 설정 이메일 주소와 전화번호를 사용하여 사용자를 생성합니다.aws cognito-idp admin-create-user \ --user-pool-id
us-west-2_aaaaaaaaa
\ --usernamediego
\ --user-attributesName=email,Value=diego@example.com
Name=phone_number,Value="+15555551212" \ --message-actionSUPPRESS
출력:
{ "User": { "Username": "diego", "Attributes": [ { "Name": "sub", "Value": "7325c1de-b05b-4f84-b321-9adc6e61f4a2" }, { "Name": "phone_number", "Value": "+15555551212" }, { "Name": "email", "Value": "diego@example.com" } ], "UserCreateDate": 1548099495.428, "UserLastModifiedDate": 1548099495.428, "Enabled": true, "UserStatus": "FORCE_CHANGE_PASSWORD" } }
-
API 세부 정보는 AWS CLI 명령 참조의 AdminCreateUser
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-delete-user-attributes
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 속성을 삭제하는 방법
이 예시에서는 사용자 diego@example.com에 대한 사용자 지정 속성 CustomAttr1을 삭제합니다.
명령:
aws cognito-idp admin-delete-user-attributes --user-pool-id
us-west-2_aaaaaaaaa
--usernamediego@example.com
--user-attribute-names"custom:CustomAttr1"
-
API 세부 정보는 AWS CLI 명령 참조의 AdminDeleteUserAttributes
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-delete-user
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 삭제
이 예시는 사용자를 삭제합니다.
명령:
aws cognito-idp admin-delete-user --user-pool-id
us-west-2_aaaaaaaaa
--usernamediego@example.com
-
API 세부 정보는 AWS CLI 명령 참조의 AdminDeleteUser
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-forget-device
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
디바이스 지우기
이 예시에서는 사용자 이름 jane@example.com의의 디바이스를 잊어버립니다.
명령:
aws cognito-idp admin-forget-device --user-pool-id
us-west-2_aaaaaaaaa
--usernamejane@example.com
--device-keyus-west-2_abcd_1234-5678
-
API 세부 정보는 AWS CLI 명령 참조의 AdminForgetDevice
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-get-device
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
디바이스를 가져오는 방법
이 예시에서는 사용자 이름 jane@example.com의의 디바이스를 가져옵니다.
명령:
aws cognito-idp admin-get-device --user-pool-id
us-west-2_aaaaaaaaa
--usernamejane@example.com
--device-keyus-west-2_abcd_1234-5678
-
API 세부 정보는 AWS CLI 명령 참조의 AdminGetDevice
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-get-user
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 가져오기
이 예시에서는 사용자 이름 jane@example.com에 대한 정보를 가져옵니다.
명령:
aws cognito-idp admin-get-user --user-pool-id
us-west-2_aaaaaaaaa
--usernamejane@example.com
출력:
{ "Username": "4320de44-2322-4620-999b-5e2e1c8df013", "Enabled": true, "UserStatus": "FORCE_CHANGE_PASSWORD", "UserCreateDate": 1548108509.537, "UserAttributes": [ { "Name": "sub", "Value": "4320de44-2322-4620-999b-5e2e1c8df013" }, { "Name": "email_verified", "Value": "true" }, { "Name": "phone_number_verified", "Value": "true" }, { "Name": "phone_number", "Value": "+01115551212" }, { "Name": "email", "Value": "jane@example.com" } ], "UserLastModifiedDate": 1548108509.537 }
-
API 세부 정보는 AWS CLI 명령 참조에서 AdminGetUser
를 참조하세요.
-
다음 코드 예시에서는 admin-initiate-auth
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
권한 부여 시작
이 예시에서는 사용자 이름 jane@example.com에 대해 ADMIN_NO_SRP_AUTH 흐름을 사용하여 권한 부여를 시작합니다.
클라이언트에는 서버 기반 인증을 위한 로그인 API(ADMIN_NO_SRP_AUTH)가 활성화되어 있어야 합니다.
반환값의 세션 정보를 사용하여 admin-respond-to-auth-challenge를 직접 호출합니다.
명령:
aws cognito-idp admin-initiate-auth --user-pool-id
us-west-2_aaaaaaaaa
--client-id3n4b5urk1ft4fl3mg5e62d9ado
--auth-flowADMIN_NO_SRP_AUTH
--auth-parametersUSERNAME=jane@example.com,PASSWORD=password
출력:
{ "ChallengeName": "NEW_PASSWORD_REQUIRED", "Session": "SESSION", "ChallengeParameters": { "USER_ID_FOR_SRP": "84514837-dcbc-4af1-abff-f3c109334894", "requiredAttributes": "[]", "userAttributes": "{\"email_verified\":\"true\",\"phone_number_verified\":\"true\",\"phone_number\":\"+01xxx5550100\",\"email\":\"jane@example.com\"}" } }
-
API 세부 정보는 AWS CLI 명령 참조에서 AdminInitiateAuth
를 참조하세요.
-
다음 코드 예시에서는 admin-list-devices
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자의 디바이스를 나열하는 방법
이 예시에서는 사용자 이름 jane@example.com의 디바이스를 나열합니다.
명령:
aws cognito-idp admin-list-devices --user-pool-id
us-west-2_aaaaaaaaa
--usernamejane@example.com
-
API 세부 정보는 AWS CLI 명령 참조의 AdminListDevices
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-list-groups-for-user
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자가 속한 그룹 나열
이 예시에서는 사용자 이름 jane@example.com의 그룹을 나열합니다.
명령:
aws cognito-idp admin-list-groups-for-user --user-pool-id
us-west-2_aaaaaaaaa
--usernamediego@example.com
출력:
{ "Groups": [ { "Description": "Sample group", "Precedence": 1, "LastModifiedDate": 1548097827.125, "RoleArn": "arn:aws:iam::111111111111:role/SampleRole", "GroupName": "SampleGroup", "UserPoolId": "us-west-2_aaaaaaaaa", "CreationDate": 1548097827.125 } ] }
-
API 세부 정보는 AWS CLI 명령 참조의 AdminListGroupsForUser
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-list-user-auth-events
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자에 대한 권한 부여 이벤트를 나열하는 방법
이 예시에서는 사용자 이름 diego@example.com에 대한 권한 부여 이벤트를 나열합니다.
명령:
aws cognito-idp admin-list-user-auth-events --user-pool-id
us-west-2_aaaaaaaaa
--usernamediego@example.com
-
API 세부 정보는 AWS CLI 명령 참조의 AdminListUserAuthEvents
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-remove-user-from-group
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
그룹에서 사용자 제거
이 예시에서는 SampleGroup에서 jane@example.com을 제거합니다.
명령:
aws cognito-idp admin-remove-user-from-group --user-pool-id
us-west-2_aaaaaaaaa
--usernamejane@example.com
--group-nameSampleGroup
-
API 세부 정보는 AWS CLI 명령 참조의 AdminRemoveUserFromGroup
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-reset-user-password
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 암호 재설정
이 예시에서는 diego@example.com의 암호를 재설정합니다.
명령:
aws cognito-idp admin-reset-user-password --user-pool-id
us-west-2_aaaaaaaaa
--usernamediego@example.com
-
API 세부 정보는 AWS CLI 명령 참조의 AdminResetUserPassword
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-set-user-mfa-preference
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 MFA 기본 설정을 지정하는 방법
이 예시에서는 사용자 이름 diego@example.com에 대한 SMS MFA 기본 설정을 설정합니다.
명령:
aws cognito-idp admin-set-user-mfa-preference --user-pool-id
us-west-2_aaaaaaaaa
--usernamediego@example.com
--sms-mfa-settingsEnabled=false,PreferredMfa=false
-
API 세부 정보는 AWS CLI 명령 참조의 AdminSetUserMfaPreference
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-set-user-settings
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 설정 구성
이 예시에서는 사용자 이름 diego@example.com에 대한 MFA 전송 기본 설정을 EMAIL로 설정합니다.
명령:
aws cognito-idp admin-set-user-settings --user-pool-id
us-west-2_aaaaaaaaa
--usernamediego@example.com
--mfa-optionsDeliveryMedium=EMAIL
-
API 세부 정보는 AWS CLI 명령 참조의 AdminSetUserSettings
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-update-auth-event-feedback
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
권한 부여 이벤트에 대한 피드백을 제공하는 방법
이 예시에서는 event-id로 식별된 권한 부여 이벤트에 대한 피드백 값을 Valid로 설정합니다.
명령:
aws cognito-idp admin-update-auth-event-feedback --user-pool-id
us-west-2_aaaaaaaaa
--usernamediego@example.com
--event-idc2c2cf89-c0d3-482d-aba6-99d78a5b0bfe
--feedback-valueValid
-
API 세부 정보는 AWS CLI 명령 참조의 AdminUpdateAuthEventFeedback
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-update-device-status
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
디바이스 상태 업데이트
이 예시에서는 device-key로 식별된 디바이스의 디바이스 기억 상태를 not_remembered로 설정합니다.
명령:
aws cognito-idp admin-update-device-status --user-pool-id
us-west-2_aaaaaaaaa
--usernamediego@example.com
--device-keyxxxx
--device-remembered-statusnot_remembered
-
API 세부 정보는 AWS CLI 명령 참조의 AdminUpdateDeviceStatus
섹션을 참조하세요.
-
다음 코드 예시에서는 admin-update-user-attributes
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 속성을 업데이트하는 방법
이 예시에서는 사용자 diego@example.com에 대한 사용자 지정 사용자 속성 CustomAttr1을 업데이트합니다.
명령:
aws cognito-idp admin-update-user-attributes --user-pool-id
us-west-2_aaaaaaaaa
--usernamediego@example.com
--user-attributes Name="custom:CustomAttr1",Value="Purple"-
API 세부 정보는 AWS CLI 명령 참조의 AdminUpdateUserAttributes
섹션을 참조하세요.
-
다음 코드 예시에서는 change-password
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
암호 변경
이 예시에서는 암호를 변경합니다.
명령:
aws cognito-idp change-password --previous-password
OldPassword
--proposed-passwordNewPassword
--access-tokenACCESS_TOKEN
-
API 세부 정보는 AWS CLI 명령 참조의 ChangePassword
를 참조하세요.
-
다음 코드 예시에서는 confirm-forgot-password
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
암호를 잊어버렸는지 확인하는 방법
이 예시에서는 사용자 이름 diego@example.com의 잊어버린 암호를 확인합니다.
명령:
aws cognito-idp confirm-forgot-password --client-id
3n4b5urk1ft4fl3mg5e62d9ado
--username=diego@example.com --passwordPASSWORD
--confirmation-codeCONF_CODE
-
API 세부 정보는 AWS CLI 명령 참조의 ConfirmForgotPassword
섹션을 참조하세요.
-
다음 코드 예시에서는 confirm-sign-up
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
가입 확인
이 예시는 사용자 이름 diego@example.com 가입을 확인합니다.
명령:
aws cognito-idp confirm-sign-up --client-id
3n4b5urk1ft4fl3mg5e62d9ado
--username=diego@example.com --confirmation-codeCONF_CODE
-
API 세부 정보는 AWS CLI 명령 참조에서 ConfirmSignUp
을 참조하세요.
-
다음 코드 예시에서는 create-group
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
그룹 생성
이 예시에서는 설명이 포함된 그룹을 생성합니다.
명령:
aws cognito-idp create-group --user-pool-id
us-west-2_aaaaaaaaa
--group-nameMyNewGroup
--description"New group."
출력:
{ "Group": { "GroupName": "MyNewGroup", "UserPoolId": "us-west-2_aaaaaaaaa", "Description": "New group.", "LastModifiedDate": 1548270073.795, "CreationDate": 1548270073.795 } }
역할 및 우선 순위가 있는 그룹을 생성하는 방법
이 예시에서는 설명이 포함된 그룹을 생성합니다. 또한 역할과 우선 순위도 포함됩니다.
명령:
aws cognito-idp create-group --user-pool-id
us-west-2_aaaaaaaaa
--group-nameMyNewGroupWithRole
--description"New group with a role."
--role-arnarn:aws:iam::111111111111:role/MyNewGroupRole
--precedence2
출력:
{ "Group": { "GroupName": "MyNewGroupWithRole", "UserPoolId": "us-west-2_aaaaaaaaa", "Description": "New group with a role.", "RoleArn": "arn:aws:iam::111111111111:role/MyNewGroupRole", "Precedence": 2, "LastModifiedDate": 1548270211.761, "CreationDate": 1548270211.761 } }
-
API 세부 정보는 AWS CLI 명령 참조의 CreateGroup
을 참조하세요.
-
다음 코드 예시에서는 create-user-import-job
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 가져오기 작업 생성
이 예시에서는 MyImportJob이라는 사용자 가져오기 작업을 만듭니다.
사용자 가져오기에 대한 자세한 내용은 CSV 파일에서 사용자 풀로 사용자 가져오기를 참조하세요.
명령:
aws cognito-idp create-user-import-job --user-pool-id
us-west-2_aaaaaaaaa
--job-nameMyImportJob
--cloud-watch-logs-role-arnarn:aws:iam::111111111111:role/CognitoCloudWatchLogsRole
출력:
{ "UserImportJob": { "JobName": "MyImportJob", "JobId": "import-qQ0DCt2fRh", "UserPoolId": "us-west-2_aaaaaaaaa", "PreSignedUrl": "PRE_SIGNED_URL", "CreationDate": 1548271795.471, "Status": "Created", "CloudWatchLogsRoleArn": "arn:aws:iam::111111111111:role/CognitoCloudWatchLogsRole", "ImportedUsers": 0, "SkippedUsers": 0, "FailedUsers": 0 } }
사전 서명된 URL을 사용하여 curl을 사용하여 .csv 파일을 업로드합니다.
명령:
curl -v -T "PATH_TO_CSV_FILE" -H "x-amz-server-side-encryption:aws:kms" "PRE_SIGNED_URL"
-
API 세부 정보는 AWS CLI 명령 참조의 CreateUserImportJob
섹션을 참조하세요.
-
다음 코드 예시에서는 create-user-pool-client
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 풀 클라이언트 생성
이 예시에서는 USER_PASSWORD_AUTH와 ADMIN_NO_SRP_AUTH라는 두 가지 명시적 권한 부여 흐름이 있는 새 사용자 풀 클라이언트를 생성합니다.
명령:
aws cognito-idp create-user-pool-client --user-pool-id
us-west-2_aaaaaaaaa
--client-nameMyNewClient
--no-generate-secret --explicit-auth-flows"USER_PASSWORD_AUTH"
"ADMIN_NO_SRP_AUTH"
출력:
{ "UserPoolClient": { "UserPoolId": "us-west-2_aaaaaaaaa", "ClientName": "MyNewClient", "ClientId": "6p3bs000no6a4ue1idruvd05ad", "LastModifiedDate": 1548697449.497, "CreationDate": 1548697449.497, "RefreshTokenValidity": 30, "ExplicitAuthFlows": [ "USER_PASSWORD_AUTH", "ADMIN_NO_SRP_AUTH" ], "AllowedOAuthFlowsUserPoolClient": false } }
-
API 세부 정보는 AWS CLI 명령 참조의 CreateUserPoolClient
섹션을 참조하세요.
-
다음 코드 예시에서는 create-user-pool-domain
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 풀 도메인 생성
이 예시에서는 USER_PASSWORD_AUTH와 ADMIN_NO_SRP_AUTH라는 두 가지 명시적 권한 부여 흐름이 있는 새 사용자 풀 도메인을 생성합니다.
명령:
aws cognito-idp create-user-pool-domain --user-pool-id
us-west-2_aaaaaaaaa
--domainmy-new-domain
-
API 세부 정보는 AWS CLI 명령 참조의 CreateUserPoolDomain
섹션을 참조하세요.
-
다음 코드 예시에서는 create-user-pool
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
최소 구성 사용자 풀 생성
이 예시에서는 기본값을 사용하여 MyUserPool이라는 사용자 풀을 만듭니다. 필수 속성도 없고 애플리케이션 클라이언트도 없습니다. MFA 및 고급 보안이 비활성화되었습니다.
명령:
aws cognito-idp create-user-pool --pool-name
MyUserPool
출력:
{ "UserPool": { "SchemaAttributes": [ { "Name": "sub", "StringAttributeConstraints": { "MinLength": "1", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": true, "AttributeDataType": "String", "Mutable": false }, { "Name": "name", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "given_name", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "family_name", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "middle_name", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "nickname", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "preferred_username", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "profile", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "picture", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "website", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "email", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "AttributeDataType": "Boolean", "DeveloperOnlyAttribute": false, "Required": false, "Name": "email_verified", "Mutable": true }, { "Name": "gender", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "birthdate", "StringAttributeConstraints": { "MinLength": "10", "MaxLength": "10" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "zoneinfo", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "locale", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "phone_number", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "AttributeDataType": "Boolean", "DeveloperOnlyAttribute": false, "Required": false, "Name": "phone_number_verified", "Mutable": true }, { "Name": "address", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "updated_at", "NumberAttributeConstraints": { "MinValue": "0" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "Number", "Mutable": true } ], "MfaConfiguration": "OFF", "Name": "MyUserPool", "LastModifiedDate": 1547833345.777, "AdminCreateUserConfig": { "UnusedAccountValidityDays": 7, "AllowAdminCreateUserOnly": false }, "EmailConfiguration": {}, "Policies": { "PasswordPolicy": { "RequireLowercase": true, "RequireSymbols": true, "RequireNumbers": true, "MinimumLength": 8, "RequireUppercase": true } }, "CreationDate": 1547833345.777, "EstimatedNumberOfUsers": 0, "Id": "us-west-2_aaaaaaaaa", "LambdaConfig": {} } }
두 개의 필수 속성으로 사용자 풀을 생성하는 방법
이 예시에서는 사용자 풀 MyUserPool을 생성합니다. 풀은 이메일을 사용자 이름 속성으로 받아들이도록 구성되어 있습니다. 또한 Amazon Simple Email Service를 사용하여 이메일 소스 주소를 검증된 주소로 설정합니다.
명령:
aws cognito-idp create-user-pool --pool-name
MyUserPool
--username-attributes"email"
--email-configuration=SourceArn="arn:aws:ses:us-east-1:111111111111:identity/jane@example.com",ReplyToEmailAddress="jane@example.com"출력:
{ "UserPool": { "SchemaAttributes": [ { "Name": "sub", "StringAttributeConstraints": { "MinLength": "1", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": true, "AttributeDataType": "String", "Mutable": false }, { "Name": "name", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "given_name", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "family_name", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "middle_name", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "nickname", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "preferred_username", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "profile", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "picture", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "website", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "email", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "AttributeDataType": "Boolean", "DeveloperOnlyAttribute": false, "Required": false, "Name": "email_verified", "Mutable": true }, { "Name": "gender", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "birthdate", "StringAttributeConstraints": { "MinLength": "10", "MaxLength": "10" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "zoneinfo", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "locale", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "phone_number", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "AttributeDataType": "Boolean", "DeveloperOnlyAttribute": false, "Required": false, "Name": "phone_number_verified", "Mutable": true }, { "Name": "address", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "updated_at", "NumberAttributeConstraints": { "MinValue": "0" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "Number", "Mutable": true } ], "MfaConfiguration": "OFF", "Name": "MyUserPool", "LastModifiedDate": 1547837788.189, "AdminCreateUserConfig": { "UnusedAccountValidityDays": 7, "AllowAdminCreateUserOnly": false }, "EmailConfiguration": { "ReplyToEmailAddress": "jane@example.com", "SourceArn": "arn:aws:ses:us-east-1:111111111111:identity/jane@example.com" }, "Policies": { "PasswordPolicy": { "RequireLowercase": true, "RequireSymbols": true, "RequireNumbers": true, "MinimumLength": 8, "RequireUppercase": true } }, "UsernameAttributes": [ "email" ], "CreationDate": 1547837788.189, "EstimatedNumberOfUsers": 0, "Id": "us-west-2_aaaaaaaaa", "LambdaConfig": {} } }
-
API 세부 정보는 AWS CLI 명령 참조의 CreateUserPool
을 참조하세요.
-
다음 코드 예시에서는 delete-group
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
그룹 삭제
이 예시에서는 그룹을 삭제합니다.
명령:
aws cognito-idp delete-group --user-pool-id
us-west-2_aaaaaaaaa
--group-nameMyGroupName
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteGroup
을 참조하세요.
-
다음 코드 예시에서는 delete-identity-provider
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
자격 증명 공급자 삭제
이 예시에서는 자격 증명 공급자를 삭제합니다.
명령:
aws cognito-idp delete-identity-provider --user-pool-id
us-west-2_aaaaaaaaa
--provider-nameFacebook
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteIdentityProvider
섹션을 참조하세요.
-
다음 코드 예시에서는 delete-resource-server
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
리소스 서버 삭제
이 예시에서는 weather.example.com 리소스 서버를 삭제합니다.
명령:
aws cognito-idp delete-resource-server --user-pool-id
us-west-2_aaaaaaaaa
--identifierweather.example.com
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteResourceServer
섹션을 참조하세요.
-
다음 코드 예시에서는 delete-user-attributes
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 속성을 삭제하는 방법
이 예시에서는 사용자 속성 "FAVORITE_ANIMAL"을 삭제합니다.
명령:
aws cognito-idp delete-user-attributes --access-token
ACCESS_TOKEN
--user-attribute-names"FAVORITE_ANIMAL"
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteUserAttributes
섹션을 참조하세요.
-
다음 코드 예시에서는 delete-user-pool-client
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 풀 클라이언트 삭제
이 예시에서는 사용자 풀 클라이언트를 삭제합니다.
명령:
aws cognito-idp delete-user-pool-client --user-pool-id
us-west-2_aaaaaaaaa
--client-id38fjsnc484p94kpqsnet7mpld0
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteUserPoolClient
섹션을 참조하세요.
-
다음 코드 예시에서는 delete-user-pool-domain
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 풀 도메인 삭제
다음
delete-user-pool-domain
예시에서는my-domain
사용자 풀 도메인을 삭제합니다.aws cognito-idp delete-user-pool-domain \ --user-pool-id
us-west-2_aaaaaaaaa
\ --domainmy-domain
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteUserPoolDomain
섹션을 참조하세요.
-
다음 코드 예시에서는 delete-user-pool
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 풀 삭제
이 예시에서는 사용자 풀 ID us-west-2_aaaaaaaa를 사용하여 사용자 풀을 삭제합니다.
명령:
aws cognito-idp delete-user-pool --user-pool-id
us-west-2_aaaaaaaaa
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteUserPool
섹션을 참조하세요.
-
다음 코드 예시에서는 delete-user
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 삭제
이 예시는 사용자를 삭제합니다.
명령:
aws cognito-idp delete-user --access-token
ACCESS_TOKEN
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteUser
를 참조하세요.
-
다음 코드 예시에서는 describe-identity-provider
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
자격 증명 공급자를 설명하는 방법
이 예시에서는 Facebook이라는 ID 제공업체를 설명합니다.
명령:
aws cognito-idp describe-identity-provider --user-pool-id
us-west-2_aaaaaaaaa
--provider-nameFacebook
출력:
{ "IdentityProvider": { "UserPoolId": "us-west-2_aaaaaaaaa", "ProviderName": "Facebook", "ProviderType": "Facebook", "ProviderDetails": { "attributes_url": "https://graph.facebook.com/me?fields=", "attributes_url_add_attributes": "true", "authorize_scopes": myscope", "authorize_url": "https://www.facebook.com/v2.9/dialog/oauth", "client_id": "11111", "client_secret": "11111", "token_request_method": "GET", "token_url": "https://graph.facebook.com/v2.9/oauth/access_token" }, "AttributeMapping": { "username": "id" }, "IdpIdentifiers": [], "LastModifiedDate": 1548105901.736, "CreationDate": 1548105901.736 } }
-
API 세부 정보는 AWS CLI 명령 참조의 DescribeIdentityProvider
섹션을 참조하세요.
-
다음 코드 예시에서는 describe-resource-server
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
리소스 서버 설명
이 예시에서는 리소스 서버 weather.example.com을 설명합니다.
명령:
aws cognito-idp describe-resource-server --user-pool-id
us-west-2_aaaaaaaaa
--identifierweather.example.com
출력:
{ "ResourceServer": { "UserPoolId": "us-west-2_aaaaaaaaa", "Identifier": "weather.example.com", "Name": "Weather", "Scopes": [ { "ScopeName": "weather.update", "ScopeDescription": "Update weather forecast" }, { "ScopeName": "weather.read", "ScopeDescription": "Read weather forecasts" }, { "ScopeName": "weather.delete", "ScopeDescription": "Delete a weather forecast" } ] } }
-
API 세부 정보는 AWS CLI 명령 참조의 DescribeResourceServer
섹션을 참조하세요.
-
다음 코드 예시에서는 describe-risk-configuration
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
리스크 구성 설명
이 예시에서는 us-west-2_aaaaaaaaa 풀과 관련된 위험 구성을 설명합니다.
명령:
aws cognito-idp describe-risk-configuration --user-pool-id
us-west-2_aaaaaaaaa
출력:
{ "RiskConfiguration": { "UserPoolId": "us-west-2_aaaaaaaaa", "CompromisedCredentialsRiskConfiguration": { "EventFilter": [ "SIGN_IN", "SIGN_UP", "PASSWORD_CHANGE" ], "Actions": { "EventAction": "BLOCK" } }, "AccountTakeoverRiskConfiguration": { "NotifyConfiguration": { "From": "diego@example.com", "ReplyTo": "diego@example.com", "SourceArn": "arn:aws:ses:us-east-1:111111111111:identity/diego@example.com", "BlockEmail": { "Subject": "Blocked sign-in attempt", "HtmlBody": "<!DOCTYPE html>\n<html>\n<head>\n\t<title>HTML email context</title>\n\t<meta charset=\"utf-8\">\n</head>\n<body>\n<pre>We blocked an unrecognized sign-in to your account with this information:\n<ul>\n<li>Time: {login-time}</li>\n<li>Device: {device-name}</li>\n<li>Location: {city}, {country}</li>\n</ul>\nIf this sign-in was not by you, you should change your password and notify us by clicking on <a href={one-click-link-invalid}>this link</a>\nIf this sign-in was by you, you can follow <a href={one-click-link-valid}>this link</a> to let us know</pre>\n</body>\n</html>", "TextBody": "We blocked an unrecognized sign-in to your account with this information:\nTime: {login-time}\nDevice: {device-name}\nLocation: {city}, {country}\nIf this sign-in was not by you, you should change your password and notify us by clicking on {one-click-link-invalid}\nIf this sign-in was by you, you can follow {one-click-link-valid} to let us know" }, "NoActionEmail": { "Subject": "New sign-in attempt", "HtmlBody": "<!DOCTYPE html>\n<html>\n<head>\n\t<title>HTML email context</title>\n\t<meta charset=\"utf-8\">\n</head>\n<body>\n<pre>We observed an unrecognized sign-in to your account with this information:\n<ul>\n<li>Time: {login-time}</li>\n<li>Device: {device-name}</li>\n<li>Location: {city}, {country}</li>\n</ul>\nIf this sign-in was not by you, you should change your password and notify us by clicking on <a href={one-click-link-invalid}>this link</a>\nIf this sign-in was by you, you can follow <a href={one-click-link-valid}>this link</a> to let us know</pre>\n</body>\n</html>", "TextBody": "We observed an unrecognized sign-in to your account with this information:\nTime: {login-time}\nDevice: {device-name}\nLocation: {city}, {country}\nIf this sign-in was not by you, you should change your password and notify us by clicking on {one-click-link-invalid}\nIf this sign-in was by you, you can follow {one-click-link-valid} to let us know" }, "MfaEmail": { "Subject": "New sign-in attempt", "HtmlBody": "<!DOCTYPE html>\n<html>\n<head>\n\t<title>HTML email context</title>\n\t<meta charset=\"utf-8\">\n</head>\n<body>\n<pre>We required you to use multi-factor authentication for the following sign-in attempt:\n<ul>\n<li>Time: {login-time}</li>\n<li>Device: {device-name}</li>\n<li>Location: {city}, {country}</li>\n</ul>\nIf this sign-in was not by you, you should change your password and notify us by clicking on <a href={one-click-link-invalid}>this link</a>\nIf this sign-in was by you, you can follow <a href={one-click-link-valid}>this link</a> to let us know</pre>\n</body>\n</html>", "TextBody": "We required you to use multi-factor authentication for the following sign-in attempt:\nTime: {login-time}\nDevice: {device-name}\nLocation: {city}, {country}\nIf this sign-in was not by you, you should change your password and notify us by clicking on {one-click-link-invalid}\nIf this sign-in was by you, you can follow {one-click-link-valid} to let us know" } }, "Actions": { "LowAction": { "Notify": true, "EventAction": "NO_ACTION" }, "MediumAction": { "Notify": true, "EventAction": "MFA_IF_CONFIGURED" }, "HighAction": { "Notify": true, "EventAction": "MFA_IF_CONFIGURED" } } } } }
-
API 세부 정보는 AWS CLI 명령 참조의 DescribeRiskConfiguration
섹션을 참조하세요.
-
다음 코드 예시에서는 describe-user-import-job
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 가져오기 작업 설명
이 예시에서는 사용자 입력 작업을 설명합니다.
사용자 가져오기에 대한 자세한 내용은 CSV 파일에서 사용자 풀로 사용자 가져오기를 참조하세요.
명령:
aws cognito-idp describe-user-import-job --user-pool-id
us-west-2_aaaaaaaaa
--job-idimport-TZqNQvDRnW
출력:
{ "UserImportJob": { "JobName": "import-Test1", "JobId": "import-TZqNQvDRnW", "UserPoolId": "us-west-2_aaaaaaaaa", "PreSignedUrl": "PRE_SIGNED URL", "CreationDate": 1548271708.512, "Status": "Created", "CloudWatchLogsRoleArn": "arn:aws:iam::111111111111:role/CognitoCloudWatchLogsRole", "ImportedUsers": 0, "SkippedUsers": 0, "FailedUsers": 0 } }
-
API 세부 정보는 AWS CLI 명령 참조의 DescribeUserImportJob
섹션을 참조하세요.
-
다음 코드 예시에서는 describe-user-pool-client
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 풀 클라이언트를 설명하는 방법
이 예시에서는 사용자 풀 클라이언트를 설명합니다.
명령:
aws cognito-idp describe-user-pool-client --user-pool-id
us-west-2_aaaaaaaaa
--client-id38fjsnc484p94kpqsnet7mpld0
출력:
{ "UserPoolClient": { "UserPoolId": "us-west-2_aaaaaaaaa", "ClientName": "MyApp", "ClientId": "38fjsnc484p94kpqsnet7mpld0", "ClientSecret": "CLIENT_SECRET", "LastModifiedDate": 1548108676.163, "CreationDate": 1548108676.163, "RefreshTokenValidity": 30, "ReadAttributes": [ "address", "birthdate", "custom:CustomAttr1", "custom:CustomAttr2", "email", "email_verified", "family_name", "gender", "given_name", "locale", "middle_name", "name", "nickname", "phone_number", "phone_number_verified", "picture", "preferred_username", "profile", "updated_at", "website", "zoneinfo" ], "WriteAttributes": [ "address", "birthdate", "custom:CustomAttr1", "custom:CustomAttr2", "email", "family_name", "gender", "given_name", "locale", "middle_name", "name", "nickname", "phone_number", "picture", "preferred_username", "profile", "updated_at", "website", "zoneinfo" ], "ExplicitAuthFlows": [ "ADMIN_NO_SRP_AUTH", "USER_PASSWORD_AUTH" ], "AllowedOAuthFlowsUserPoolClient": false } }
-
API 세부 정보는 AWS CLI 명령 참조의 DescribeUserPoolClient
섹션을 참조하세요.
-
다음 코드 예시에서는 describe-user-pool-domain
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 풀 클라이언트를 설명하는 방법
이 예시에서는 my-domain이라는 사용자 풀 도메인을 설명합니다.
명령:
aws cognito-idp describe-user-pool-domain --domain
my-domain
출력:
{ "DomainDescription": { "UserPoolId": "us-west-2_aaaaaaaaa", "AWSAccountId": "111111111111", "Domain": "my-domain", "S3Bucket": "aws-cognito-prod-pdx-assets", "CloudFrontDistribution": "aaaaaaaaaaaaa.cloudfront.net", "Version": "20190128175402", "Status": "ACTIVE", "CustomDomainConfig": {} } }
-
API 세부 정보는 AWS CLI 명령 참조의 DescribeUserPoolDomain
섹션을 참조하세요.
-
다음 코드 예시에서는 describe-user-pool
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 풀을 설명하는 방법
이 예시에서는 사용자 풀 ID us-west-2_aaaaaaaaaa를 사용하는 사용자 풀을 설명합니다.
명령:
aws cognito-idp describe-user-pool --user-pool-id
us-west-2_aaaaaaaaa
출력:
{ "UserPool": { "SmsVerificationMessage": "Your verification code is {####}. ", "SchemaAttributes": [ { "Name": "sub", "StringAttributeConstraints": { "MinLength": "1", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": true, "AttributeDataType": "String", "Mutable": false }, { "Name": "name", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "given_name", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "family_name", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "middle_name", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "nickname", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "preferred_username", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "profile", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "picture", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "website", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "email", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": true, "AttributeDataType": "String", "Mutable": true }, { "AttributeDataType": "Boolean", "DeveloperOnlyAttribute": false, "Required": false, "Name": "email_verified", "Mutable": true }, { "Name": "gender", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "birthdate", "StringAttributeConstraints": { "MinLength": "10", "MaxLength": "10" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "zoneinfo", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "locale", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "phone_number", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "AttributeDataType": "Boolean", "DeveloperOnlyAttribute": false, "Required": false, "Name": "phone_number_verified", "Mutable": true }, { "Name": "address", "StringAttributeConstraints": { "MinLength": "0", "MaxLength": "2048" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "String", "Mutable": true }, { "Name": "updated_at", "NumberAttributeConstraints": { "MinValue": "0" }, "DeveloperOnlyAttribute": false, "Required": false, "AttributeDataType": "Number", "Mutable": true } ], "EmailVerificationSubject": "Your verification code", "MfaConfiguration": "OFF", "Name": "MyUserPool", "EmailVerificationMessage": "Your verification code is {####}. ", "SmsAuthenticationMessage": "Your authentication code is {####}. ", "LastModifiedDate": 1547763720.822, "AdminCreateUserConfig": { "InviteMessageTemplate": { "EmailMessage": "Your username is {username} and temporary password is {####}. ", "EmailSubject": "Your temporary password", "SMSMessage": "Your username is {username} and temporary password is {####}. " }, "UnusedAccountValidityDays": 7, "AllowAdminCreateUserOnly": false }, "EmailConfiguration": { "ReplyToEmailAddress": "myemail@mydomain.com" "SourceArn": "arn:aws:ses:us-east-1:000000000000:identity/myemail@mydomain.com" }, "AutoVerifiedAttributes": [ "email" ], "Policies": { "PasswordPolicy": { "RequireLowercase": true, "RequireSymbols": true, "RequireNumbers": true, "MinimumLength": 8, "RequireUppercase": true } }, "UserPoolTags": {}, "UsernameAttributes": [ "email" ], "CreationDate": 1547763720.822, "EstimatedNumberOfUsers": 1, "Id": "us-west-2_aaaaaaaaa", "LambdaConfig": {} } }
-
API 세부 정보는 AWS CLI 명령 참조의 DescribeUserPool
섹션을 참조하세요.
-
다음 코드 예시에서는 forget-device
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
디바이스 지우기
이 예시에서는 디바이스를 잊어버립니다.
명령:
aws cognito-idp forget-device --device-key
us-west-2_abcd_1234-5678
-
API 세부 정보는 AWS CLI 명령 참조의 ForgetDevice
섹션을 참조하세요.
-
다음 코드 예시에서는 forgot-password
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
암호를 강제로 변경하는 방법
다음
forgot-password
예시에서는 암호를 변경하라는 메시지를 jane@example.com으로 보냅니다.aws cognito-idp forgot-password --client-id
38fjsnc484p94kpqsnet7mpld0
--usernamejane@example.com
출력:
{ "CodeDeliveryDetails": { "Destination": "j***@e***.com", "DeliveryMedium": "EMAIL", "AttributeName": "email" } }
-
API 세부 정보는 AWS CLI 명령 참조의 ForgotPassword
섹션을 참조하세요.
-
다음 코드 예시에서는 get-csv-header
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
csv 헤더를 생성하는 방법
이 예시에서는 csv 헤더를 생성합니다.
사용자 가져오기에 대한 자세한 내용은 CSV 파일에서 사용자 풀로 사용자 가져오기를 참조하세요.
명령:
aws cognito-idp get-csv-header --user-pool-id
us-west-2_aaaaaaaaa
출력:
{ "UserPoolId": "us-west-2_aaaaaaaaa", "CSVHeader": [ "name", "given_name", "family_name", "middle_name", "nickname", "preferred_username", "profile", "picture", "website", "email", "email_verified", "gender", "birthdate", "zoneinfo", "locale", "phone_number", "phone_number_verified", "address", "updated_at", "cognito:mfa_enabled", "cognito:username" ] }
... CSV 파일에서 사용자 풀로 사용자 가져오기: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-using-import-tool.html
-
API 세부 정보는 AWS CLI 명령 참조의 GetCsvHeader
섹션을 참조하세요.
-
다음 코드 예시에서는 get-group
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
그룹에 대한 정보 가져오기
이 예시에서는 MyGroup 그룹에 대한 정보를 가져옵니다.
명령:
aws cognito-idp get-group --user-pool-id
us-west-2_aaaaaaaaa
--group-nameMyGroup
출력:
{ "Group": { "GroupName": "MyGroup", "UserPoolId": "us-west-2_aaaaaaaaa", "Description": "A sample group.", "LastModifiedDate": 1548270073.795, "CreationDate": 1548270073.795 } }
-
API 세부 정보는 AWS CLI 명령 참조의 GetGroup
을 참조하세요.
-
다음 코드 예시에서는 get-signing-certificate
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
서명 인증서를 가져오는 방법
이 예시에서는 사용자 풀에 대한 서명 인증서를 가져옵니다.
명령:
aws cognito-idp get-signing-certificate --user-pool-id
us-west-2_aaaaaaaaa
출력:
{ "Certificate": "CERTIFICATE_DATA" }
-
API 세부 정보는 AWS CLI 명령 참조의 GetSigningCertificate
섹션을 참조하세요.
-
다음 코드 예시에서는 get-ui-customization
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
UI 사용자 지정 정보를 가져오는 방법
이 예시에서는 사용자 풀에 대한 UI 사용자 지정 정보를 가져옵니다.
명령:
aws cognito-idp get-ui-customization --user-pool-id
us-west-2_aaaaaaaaa
출력:
{ "UICustomization": { "UserPoolId": "us-west-2_aaaaaaaaa", "ClientId": "ALL", "ImageUrl": "https://aaaaaaaaaaaaa.cloudfront.net/us-west-2_aaaaaaaaa/ALL/20190128231240/assets/images/image.jpg", "CSS": ".logo-customizable {\n\tmax-width: 60%;\n\tmax-height: 30%;\n}\n.banner-customizable {\n\tpadding: 25px 0px 25px 10px;\n\tbackground-color: lightgray;\n}\n.label-customizable {\n\tfont-weight: 300;\n}\n.textDescription-customizable {\n\tpadding-top: 10px;\n\tpadding-bottom: 10px;\n\tdisplay: block;\n\tfont-size: 16px;\n}\n.idpDescription-customizable {\n\tpadding-top: 10px;\n\tpadding-bottom: 10px;\n\tdisplay: block;\n\tfont-size: 16px;\n}\n.legalText-customizable {\n\tcolor: #747474;\n\tfont-size: 11px;\n}\n.submitButton-customizable {\n\tfont-size: 14px;\n\tfont-weight: bold;\n\tmargin: 20px 0px 10px 0px;\n\theight: 40px;\n\twidth: 100%;\n\tcolor: #fff;\n\tbackground-color: #337ab7;\n}\n.submitButton-customizable:hover {\n\tcolor: #fff;\n\tbackground-color: #286090;\n}\n.errorMessage-customizable {\n\tpadding: 5px;\n\tfont-size: 14px;\n\twidth: 100%;\n\tbackground: #F5F5F5;\n\tborder: 2px solid #D64958;\n\tcolor: #D64958;\n}\n.inputField-customizable {\n\twidth: 100%;\n\theight: 34px;\n\tcolor: #555;\n\tbackground-color: #fff;\n\tborder: 1px solid #ccc;\n}\n.inputField-customizable:focus {\n\tborder-color: #66afe9;\n\toutline: 0;\n}\n.idpButton-customizable {\n\theight: 40px;\n\twidth: 100%;\n\ttext-align: center;\n\tmargin-bottom: 15px;\n\tcolor: #fff;\n\tbackground-color: #5bc0de;\n\tborder-color: #46b8da;\n}\n.idpButton-customizable:hover {\n\tcolor: #fff;\n\tbackground-color: #31b0d5;\n}\n.socialButton-customizable {\n\theight: 40px;\n\ttext-align: left;\n\twidth: 100%;\n\tmargin-bottom: 15px;\n}\n.redirect-customizable {\n\ttext-align: center;\n}\n.passwordCheck-notValid-customizable {\n\tcolor: #DF3312;\n}\n.passwordCheck-valid-customizable {\n\tcolor: #19BF00;\n}\n.background-customizable {\n\tbackground-color: #faf;\n}\n", "CSSVersion": "20190128231240" } }
-
API 세부 정보는 AWS CLI 명령 참조의 GetUiCustomization
섹션을 참조하세요.
-
다음 코드 예시에서는 list-user-import-jobs
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 가져오기 작업 나열
이 예시에서는 사용자 가져오기 작업을 나열합니다.
사용자 가져오기에 대한 자세한 내용은 CSV 파일에서 사용자 풀로 사용자 가져오기를 참조하세요.
명령:
aws cognito-idp list-user-import-jobs --user-pool-id
us-west-2_aaaaaaaaa
--max-results20
출력:
{ "UserImportJobs": [ { "JobName": "Test2", "JobId": "import-d0OnwGA3mV", "UserPoolId": "us-west-2_aaaaaaaaa", "PreSignedUrl": "PRE_SIGNED_URL", "CreationDate": 1548272793.069, "Status": "Created", "CloudWatchLogsRoleArn": "arn:aws:iam::111111111111:role/CognitoCloudWatchLogsRole", "ImportedUsers": 0, "SkippedUsers": 0, "FailedUsers": 0 }, { "JobName": "Test1", "JobId": "import-qQ0DCt2fRh", "UserPoolId": "us-west-2_aaaaaaaaa", "PreSignedUrl": "PRE_SIGNED_URL", "CreationDate": 1548271795.471, "Status": "Created", "CloudWatchLogsRoleArn": "arn:aws:iam::111111111111:role/CognitoCloudWatchLogsRole", "ImportedUsers": 0, "SkippedUsers": 0, "FailedUsers": 0 }, { "JobName": "import-Test1", "JobId": "import-TZqNQvDRnW", "UserPoolId": "us-west-2_aaaaaaaaa", "PreSignedUrl": "PRE_SIGNED_URL", "CreationDate": 1548271708.512, "StartDate": 1548277247.962, "CompletionDate": 1548277248.912, "Status": "Failed", "CloudWatchLogsRoleArn": "arn:aws:iam::111111111111:role/CognitoCloudWatchLogsRole", "ImportedUsers": 0, "SkippedUsers": 0, "FailedUsers": 1, "CompletionMessage": "Too many users have failed or been skipped during the import." } ] }
-
API 세부 정보는 AWS CLI 명령 참조의 ListUserImportJobs
섹션을 참조하세요.
-
다음 코드 예시에서는 list-user-pools
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 풀 나열
이 예시에서는 최대 20개의 사용자 풀을 나열합니다.
명령:
aws cognito-idp list-user-pools --max-results
20
출력:
{ "UserPools": [ { "CreationDate": 1547763720.822, "LastModifiedDate": 1547763720.822, "LambdaConfig": {}, "Id": "us-west-2_aaaaaaaaa", "Name": "MyUserPool" } ] }
-
API 세부 정보는 AWS CLI 명령 참조에서 ListUserPools
를 참조하세요.
-
다음 코드 예시에서는 list-users-in-group
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
그룹의 사용자를 나열하는 방법
이 예시에서는 MyGroup 그룹의 사용자를 나열합니다.
명령:
aws cognito-idp list-users-in-group --user-pool-id
us-west-2_aaaaaaaaa
--group-nameMyGroup
출력:
{ "Users": [ { "Username": "acf10624-80bb-401a-ac61-607bee2110ec", "Attributes": [ { "Name": "sub", "Value": "acf10624-80bb-401a-ac61-607bee2110ec" }, { "Name": "custom:CustomAttr1", "Value": "New Value!" }, { "Name": "email", "Value": "jane@example.com" } ], "UserCreateDate": 1548102770.284, "UserLastModifiedDate": 1548103204.893, "Enabled": true, "UserStatus": "CONFIRMED" }, { "Username": "22704aa3-fc10-479a-97eb-2af5806bd327", "Attributes": [ { "Name": "sub", "Value": "22704aa3-fc10-479a-97eb-2af5806bd327" }, { "Name": "email_verified", "Value": "true" }, { "Name": "email", "Value": "diego@example.com" } ], "UserCreateDate": 1548089817.683, "UserLastModifiedDate": 1548089817.683, "Enabled": true, "UserStatus": "FORCE_CHANGE_PASSWORD" } ] }
-
API 세부 정보는 AWS CLI 명령 참조의 ListUsersInGroup
섹션을 참조하세요.
-
다음 코드 예시에서는 list-users
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 나열
이 예시에서는 최대 20개의 사용자를 나열합니다.
명령:
aws cognito-idp list-users --user-pool-id
us-west-2_aaaaaaaaa
--limit20
출력:
{ "Users": [ { "Username": "22704aa3-fc10-479a-97eb-2af5806bd327", "Enabled": true, "UserStatus": "FORCE_CHANGE_PASSWORD", "UserCreateDate": 1548089817.683, "UserLastModifiedDate": 1548089817.683, "Attributes": [ { "Name": "sub", "Value": "22704aa3-fc10-479a-97eb-2af5806bd327" }, { "Name": "email_verified", "Value": "true" }, { "Name": "email", "Value": "mary@example.com" } ] } ] }
-
API 세부 정보는 AWS CLI 명령 참조의 ListUsers
를 참조하세요.
-
다음 코드 예시에서는 resend-confirmation-code
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
확인 코드 다시 보내기
다음
resend-confirmation-code
예시에서는 사용자jane
에게 확인 코드를 보냅니다.aws cognito-idp resend-confirmation-code \ --client-id
12a3b456c7de890f11g123hijk
\ --usernamejane
출력:
{ "CodeDeliveryDetails": { "Destination": "j***@e***.com", "DeliveryMedium": "EMAIL", "AttributeName": "email" } }
자세한 내용은 Amazon Cognito 개발자 안내서의 사용자 계정 가입 및 확인 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조에서 ResendConfirmationCode
를 참조하세요.
-
다음 코드 예시에서는 respond-to-auth-challenge
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
인증 문제에 응답
이 예시에서는 initiate-auth로 시작된 인증 문제에 응답합니다. 이것은 NEW_PASSWORD_REQUIRED 문제에 대한 응답입니다. 사용자 jane@example.com의 암호를 설정합니다.
명령:
aws cognito-idp respond-to-auth-challenge --client-id
3n4b5urk1ft4fl3mg5e62d9ado
--challenge-nameNEW_PASSWORD_REQUIRED
--challenge-responses USERNAME=jane@example.com,NEW_PASSWORD="password" --session"SESSION_TOKEN"
출력:
{ "ChallengeParameters": {}, "AuthenticationResult": { "AccessToken": "ACCESS_TOKEN", "ExpiresIn": 3600, "TokenType": "Bearer", "RefreshToken": "REFRESH_TOKEN", "IdToken": "ID_TOKEN", "NewDeviceMetadata": { "DeviceKey": "us-west-2_fec070d2-fa88-424a-8ec8-b26d7198eb23", "DeviceGroupKey": "-wt2ha1Zd" } } }
-
API 세부 정보는 AWS CLI 명령 참조에서 RespondToAuthChallenge
를 참조하세요.
-
다음 코드 예시에서는 set-risk-configuration
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
위험 구성을 설정하는 방법
이 예시에서는 사용자 풀에 대한 위험 구성을 설정합니다. 가입 이벤트 작업을 NO_ACTION으로 설정합니다.
명령:
aws cognito-idp set-risk-configuration --user-pool-id
us-west-2_aaaaaaaaa
--compromised-credentials-risk-configurationEventFilter=SIGN_UP,Actions={EventAction=NO_ACTION}
출력:
{ "RiskConfiguration": { "UserPoolId": "us-west-2_aaaaaaaaa", "CompromisedCredentialsRiskConfiguration": { "EventFilter": [ "SIGN_UP" ], "Actions": { "EventAction": "NO_ACTION" } } } }
-
API 세부 정보는 AWS CLI 명령 참조의 SetRiskConfiguration
섹션을 참조하세요.
-
다음 코드 예시에서는 set-ui-customization
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
UI 사용자 지정을 설정하는 방법
이 예시에서는 사용자 풀에 대한 CSS 설정을 사용자 지정합니다.
명령:
aws cognito-idp set-ui-customization --user-pool-id
us-west-2_aaaaaaaaa
--css".logo-customizable {\n\tmax-width: 60%;\n\tmax-height: 30%;\n}\n.banner-customizable {\n\tpadding: 25px 0px 25px 10px;\n\tbackground-color: lightgray;\n}\n.label-customizable {\n\tfont-weight: 300;\n}\n.textDescription-customizable {\n\tpadding-top: 10px;\n\tpadding-bottom: 10px;\n\tdisplay: block;\n\tfont-size: 16px;\n}\n.idpDescription-customizable {\n\tpadding-top: 10px;\n\tpadding-bottom: 10px;\n\tdisplay: block;\n\tfont-size: 16px;\n}\n.legalText-customizable {\n\tcolor: #747474;\n\tfont-size: 11px;\n}\n.submitButton-customizable {\n\tfont-size: 14px;\n\tfont-weight: bold;\n\tmargin: 20px 0px 10px 0px;\n\theight: 40px;\n\twidth: 100%;\n\tcolor: #fff;\n\tbackground-color: #337ab7;\n}\n.submitButton-customizable:hover {\n\tcolor: #fff;\n\tbackground-color: #286090;\n}\n.errorMessage-customizable {\n\tpadding: 5px;\n\tfont-size: 14px;\n\twidth: 100%;\n\tbackground: #F5F5F5;\n\tborder: 2px solid #D64958;\n\tcolor: #D64958;\n}\n.inputField-customizable {\n\twidth: 100%;\n\theight: 34px;\n\tcolor: #555;\n\tbackground-color: #fff;\n\tborder: 1px solid #ccc;\n}\n.inputField-customizable:focus {\n\tborder-color: #66afe9;\n\toutline: 0;\n}\n.idpButton-customizable {\n\theight: 40px;\n\twidth: 100%;\n\ttext-align: center;\n\tmargin-bottom: 15px;\n\tcolor: #fff;\n\tbackground-color: #5bc0de;\n\tborder-color: #46b8da;\n}\n.idpButton-customizable:hover {\n\tcolor: #fff;\n\tbackground-color: #31b0d5;\n}\n.socialButton-customizable {\n\theight: 40px;\n\ttext-align: left;\n\twidth: 100%;\n\tmargin-bottom: 15px;\n}\n.redirect-customizable {\n\ttext-align: center;\n}\n.passwordCheck-notValid-customizable {\n\tcolor: #DF3312;\n}\n.passwordCheck-valid-customizable {\n\tcolor: #19BF00;\n}\n.background-customizable {\n\tbackground-color: #faf;\n}\n"
출력:
{ "UICustomization": { "UserPoolId": "us-west-2_aaaaaaaaa", "ClientId": "ALL", "CSS": ".logo-customizable {\n\tmax-width: 60%;\n\tmax-height: 30%;\n}\n.banner-customizable {\n\tpadding: 25px 0px 25px 10px;\n\tbackground-color: lightgray;\n}\n.label-customizable {\n\tfont-weight: 300;\n}\n.textDescription-customizable {\n\tpadding-top: 10px;\n\tpadding-bottom: 10px;\n\tdisplay: block;\n\tfont-size: 16px;\n}\n.idpDescription-customizable {\n\tpadding-top: 10px;\n\tpadding-bottom: 10px;\n\tdisplay: block;\n\tfont-size: 16px;\n}\n.legalText-customizable {\n\tcolor: #747474;\n\tfont-size: 11px;\n}\n.submitButton-customizable {\n\tfont-size: 14px;\n\tfont-weight: bold;\n\tmargin: 20px 0px 10px 0px;\n\theight: 40px;\n\twidth: 100%;\n\tcolor: #fff;\n\tbackground-color: #337ab7;\n}\n.submitButton-customizable:hover {\n\tcolor: #fff;\n\tbackground-color: #286090;\n}\n.errorMessage-customizable {\n\tpadding: 5px;\n\tfont-size: 14px;\n\twidth: 100%;\n\tbackground: #F5F5F5;\n\tborder: 2px solid #D64958;\n\tcolor: #D64958;\n}\n.inputField-customizable {\n\twidth: 100%;\n\theight: 34px;\n\tcolor: #555;\n\tbackground-color: #fff;\n\tborder: 1px solid #ccc;\n}\n.inputField-customizable:focus {\n\tborder-color: #66afe9;\n\toutline: 0;\n}\n.idpButton-customizable {\n\theight: 40px;\n\twidth: 100%;\n\ttext-align: center;\n\tmargin-bottom: 15px;\n\tcolor: #fff;\n\tbackground-color: #5bc0de;\n\tborder-color: #46b8da;\n}\n.idpButton-customizable:hover {\n\tcolor: #fff;\n\tbackground-color: #31b0d5;\n}\n.socialButton-customizable {\n\theight: 40px;\n\ttext-align: left;\n\twidth: 100%;\n\tmargin-bottom: 15px;\n}\n.redirect-customizable {\n\ttext-align: center;\n}\n.passwordCheck-notValid-customizable {\n\tcolor: #DF3312;\n}\n.passwordCheck-valid-customizable {\n\tcolor: #19BF00;\n}\n.background-customizable {\n\tbackground-color: #faf;\n}\n", "CSSVersion": "20190129172214" } }
-
API 세부 정보는 AWS CLI 명령 참조의 SetUiCustomization
섹션을 참조하세요.
-
다음 코드 예시에서는 set-user-mfa-preference
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 MFA 설정을 설정하는 방법
다음
set-user-mfa-preference
예시에서는 MFA 전송 옵션을 수정합니다. MFA 전송 미디어를 SMS로 변경합니다.aws cognito-idp set-user-mfa-preference \ --access-token
"eyJra12345EXAMPLE"
\ --software-token-mfa-settingsEnabled=true,PreferredMfa=true
\ --sms-mfa-settingsEnabled=false,PreferredMfa=false
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon Cognito 개발자 안내서의 Adding MFA to a user pool을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 SetUserMfaPreference
섹션을 참조하세요.
-
다음 코드 예시에서는 set-user-settings
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 설정 구성
이 예시에서는 MFA 배달 기본 설정을 EMAIL로 설정합니다.
명령:
aws cognito-idp set-user-settings --access-token
ACCESS_TOKEN
--mfa-optionsDeliveryMedium=EMAIL
-
API 세부 정보는 AWS CLI 명령 참조의 SetUserSettings
섹션을 참조하세요.
-
다음 코드 예시에서는 sign-up
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 가입
이 예시에서는 jane@example.com에 가입합니다.
명령:
aws cognito-idp sign-up --client-id
3n4b5urk1ft4fl3mg5e62d9ado
--usernamejane@example.com
--passwordPASSWORD
--user-attributes Name="email",Value="jane@example.com" Name="name",Value="Jane"출력:
{ "UserConfirmed": false, "UserSub": "e04d60a6-45dc-441c-a40b-e25a787d4862" }
-
API 세부 정보는 AWS CLI 명령 참조에서 SignUp
을 참조하세요.
-
다음 코드 예시에서는 start-user-import-job
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 가져오기 작업 시작
이 예시에서는 사용자 입력 작업을 시작합니다.
사용자 가져오기에 대한 자세한 내용은 CSV 파일에서 사용자 풀로 사용자 가져오기를 참조하세요.
명령:
aws cognito-idp start-user-import-job --user-pool-id
us-west-2_aaaaaaaaa
--job-idimport-TZqNQvDRnW
출력:
{ "UserImportJob": { "JobName": "import-Test10", "JobId": "import-lmpxSOuIzH", "UserPoolId": "us-west-2_aaaaaaaaa", "PreSignedUrl": "PRE_SIGNED_URL", "CreationDate": 1548278378.928, "StartDate": 1548278397.334, "Status": "Pending", "CloudWatchLogsRoleArn": "arn:aws:iam::111111111111:role/CognitoCloudWatchLogsRole", "ImportedUsers": 0, "SkippedUsers": 0, "FailedUsers": 0 } }
-
API 세부 정보는 AWS CLI 명령 참조의 StartUserImportJob
섹션을 참조하세요.
-
다음 코드 예시에서는 stop-user-import-job
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 가져오기 작업 중지
이 예시에서는 사용자 입력 작업을 중지합니다.
사용자 가져오기에 대한 자세한 내용은 CSV 파일에서 사용자 풀로 사용자 가져오기를 참조하세요.
명령:
aws cognito-idp stop-user-import-job --user-pool-id
us-west-2_aaaaaaaaa
--job-idimport-TZqNQvDRnW
출력:
{ "UserImportJob": { "JobName": "import-Test5", "JobId": "import-Fx0kARISFL", "UserPoolId": "us-west-2_aaaaaaaaa", "PreSignedUrl": "PRE_SIGNED_URL", "CreationDate": 1548278576.259, "StartDate": 1548278623.366, "CompletionDate": 1548278626.741, "Status": "Stopped", "CloudWatchLogsRoleArn": "arn:aws:iam::111111111111:role/CognitoCloudWatchLogsRole", "ImportedUsers": 0, "SkippedUsers": 0, "FailedUsers": 0, "CompletionMessage": "The Import Job was stopped by the developer." } }
-
API 세부 정보는 AWS CLI 명령 참조의 StopUserImportJob
섹션을 참조하세요.
-
다음 코드 예시에서는 update-auth-event-feedback
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
인증 이벤트 피드백을 업데이트하는 방법
이 예시에서는 권한 부여 이벤트 피드백을 업데이트합니다. 이벤트를 'Valid'로 표시합니다.
명령:
aws cognito-idp update-auth-event-feedback --user-pool-id
us-west-2_aaaaaaaaa
--usernamediego@example.com
--event-idEVENT_ID
--feedback-tokenFEEDBACK_TOKEN
--feedback-value"Valid"
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateAuthEventFeedback
섹션을 참조하세요.
-
다음 코드 예시에서는 update-device-status
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
디바이스 상태 업데이트
이 예시에서는 디바이스의 상태를 'not_remembered'로 업데이트합니다.
명령:
aws cognito-idp update-device-status --access-token
ACCESS_TOKEN
--device-keyDEVICE_KEY
--device-remembered-status"not_remembered"
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateDeviceStatus
섹션을 참조하세요.
-
다음 코드 예시에서는 update-group
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
그룹 업데이트
이 예시에서는 MyGroup에 대한 설명과 우선 순위를 업데이트합니다.
명령:
aws cognito-idp update-group --user-pool-id
us-west-2_aaaaaaaaa
--group-nameMyGroup
--description"New description"
--precedence2
출력:
{ "Group": { "GroupName": "MyGroup", "UserPoolId": "us-west-2_aaaaaaaaa", "Description": "New description", "RoleArn": "arn:aws:iam::111111111111:role/MyRole", "Precedence": 2, "LastModifiedDate": 1548800862.812, "CreationDate": 1548097827.125 } }
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateGroup
을 참조하세요.
-
다음 코드 예시에서는 update-resource-server
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
리소스 서버 업데이트
이 예시에서는 리소스 서버 날씨를 업데이트합니다. 새 범위가 추가됩니다.
명령:
aws cognito-idp update-resource-server --user-pool-id
us-west-2_aaaaaaaaa
--identifierweather.example.com
--nameWeather
--scopes ScopeName=NewScope,ScopeDescription="New scope description"출력:
{ "ResourceServer": { "UserPoolId": "us-west-2_aaaaaaaaa", "Identifier": "weather.example.com", "Name": "Happy", "Scopes": [ { "ScopeName": "NewScope", "ScopeDescription": "New scope description" } ] } }
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateResourceServer
섹션을 참조하세요.
-
다음 코드 예시에서는 update-user-attributes
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 속성을 업데이트하는 방법
이 예시에서는 사용자 속성 'nickname'을 업데이트합니다.
명령:
aws cognito-idp update-user-attributes --access-token
ACCESS_TOKEN
--user-attributes Name="nickname",Value="Dan"-
API 세부 정보는 AWS CLI 명령 참조의 UpdateUserAttributes
섹션을 참조하세요.
-
다음 코드 예시에서는 update-user-pool-client
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 풀 클라이언트 업데이트
이 예시에서는 사용자 풀 클라이언트의 이름을 업데이트합니다. 또한 쓰기 가능한 속성인 'nickname'도 추가합니다.
명령:
aws cognito-idp update-user-pool-client --user-pool-id
us-west-2_aaaaaaaaa
--client-id3n4b5urk1ft4fl3mg5e62d9ado
--client-name"NewClientName"
--write-attributes"nickname"
출력:
{ "UserPoolClient": { "UserPoolId": "us-west-2_aaaaaaaaa", "ClientName": "NewClientName", "ClientId": "3n4b5urk1ft4fl3mg5e62d9ado", "LastModifiedDate": 1548802761.334, "CreationDate": 1548178931.258, "RefreshTokenValidity": 30, "WriteAttributes": [ "nickname" ], "AllowedOAuthFlowsUserPoolClient": false } }
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateUserPoolClient
섹션을 참조하세요.
-
다음 코드 예시에서는 update-user-pool
코드를 사용하는 방법을 보여줍니다.
- AWS CLI
-
사용자 풀 업데이트
다음
update-user-pool
예시에서는 사용 가능한 각 구성 옵션에 대한 예시 구문으로 사용자 풀을 수정합니다. 사용자 풀을 업데이트하려면 이전에 구성된 모든 옵션을 지정해야 합니다. 그렇지 않으면 옵션이 기본값으로 재설정됩니다.aws cognito-idp update-user-pool --user-pool-id
us-west-2_EXAMPLE
\ --policies PasswordPolicy=\{MinimumLength=6,RequireUppercase=true,RequireLowercase=true,RequireNumbers=true,RequireSymbols=true,TemporaryPasswordValidityDays=7\} \ --deletion-protectionACTIVE
\ --lambda-config PreSignUp="arn:aws:lambda:us-west-2:123456789012:function:cognito-test-presignup-function",PreTokenGeneration="arn:aws:lambda:us-west-2:123456789012:function:cognito-test-pretoken-function" \ --auto-verified-attributes"phone_number"
"email"
\ --verification-message-template \{\"SmsMessage\":\""Your code is {####}"
\",\"EmailMessage\":\""Your code is {####}"\",\"EmailSubject\":\""Your verification code"\",\"EmailMessageByLink\":\""Click {##here##} to verify your email address."\",\"EmailSubjectByLink\":\""Your verification link"\",\"DefaultEmailOption\":\"CONFIRM_WITH_LINK\"\} \ --sms-authentication-message "Your code is {####}" \ --user-attribute-update-settings AttributesRequireVerificationBeforeUpdate="email","phone_number" \ --mfa-configuration"OPTIONAL"
\ --device-configurationChallengeRequiredOnNewDevice=true,DeviceOnlyRememberedOnUserPrompt=true
\ --email-configuration SourceArn="arn:aws:ses:us-west-2:123456789012:identity/admin@example.com",ReplyToEmailAddress="amdin+noreply@example.com",EmailSendingAccount=DEVELOPER,From="admin@amazon.com",ConfigurationSet="test-configuration-set" \ --sms-configuration SnsCallerArn="arn:aws:iam::123456789012:role/service-role/SNS-SMS-Role",ExternalId="12345",SnsRegion="us-west-2" \ --admin-create-user-config AllowAdminCreateUserOnly=false,InviteMessageTemplate=\{SMSMessage=\""Welcome {username}. Your confirmation code is {####}"\",EmailMessage=\""Welcome {username}. Your confirmation code is {####}"\",EmailSubject=\""Welcome to MyMobileGame"\"\} \ --user-pool-tags "Function"="MyMobileGame","Developers"="Berlin" \ --admin-create-user-config AllowAdminCreateUserOnly=false,InviteMessageTemplate=\{SMSMessage=\""Welcome {username}. Your confirmation code is {####}"\",EmailMessage=\""Welcome {username}. Your confirmation code is {####}"\",EmailSubject=\""Welcome to MyMobileGame"\"\} \ --user-pool-add-ons AdvancedSecurityMode="AUDIT" \ --account-recovery-setting RecoveryMechanisms=\[\{Priority=1,Name="verified_email"\},\{Priority=2,Name="verified_phone_number"\}\]이 명령은 출력을 생성하지 않습니다.
자세한 내용은 Amazon Cognito 개발자 안내서의 Updating user pool configuration을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateUserPool
섹션을 참조하세요.
-