We can create a Cognito user pool as follows:
aws cognito-idp create-user-pool
--cli-input-json file://create-user-pool-cli-input.json
--region us-east-1
--profile admin
The create-user-pool-cli-input.json file has the following contents:
{
"PoolName": "javscript_pool",
"Policies": {
"PasswordPolicy": {
"MinimumLength": 8,
"RequireUppercase": true,
"RequireLowercase": true,
"RequireNumbers": true,
"RequireSymbols": true
}
},
"AutoVerifiedAttributes": [
"email"
],
"AliasAttributes": [
"email"
],
"EmailVerificationMessage": "Your verification code from MyApp is {####}",
"EmailVerificationSubject": "Your verification code from MyAp",
"UserPoolTags": {
"Team": "Dev"
}
}
This is the same as what we have seen in Chapter 4, Application Security with Amazon Cognito, which we can refer to for more details and explanations.
Create a user pool client:
aws cognito-idp create-user-pool-client
--user-pool-id us-east-1_P8srRzYqn
--client-name javscript-pool-client
--explicit-auth-flows USER_PASSWORD_AUTH
--region us-east-1
--profile admin
Replace the user pool ID value with the ID of the user pool you created in the previous step.