Last active
May 9, 2019 14:45
-
-
Save stfnhh/e94e142b424203c3f2d32821748cb506 to your computer and use it in GitHub Desktop.
Creates and confirms an AWS Cognito user with custom attributes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
CLIENT_ID="" | |
POOL_ID="" | |
JOBS="" | |
EMAIL="" | |
PASSWORD="" | |
REGION="" | |
ATTRIBUTES=( | |
"key:value" | |
"key:value" | |
) | |
aws cognito-idp sign-up \ | |
--region us-east-1 \ | |
--client-id $CLIENT_ID \ | |
--username $EMAIL \ | |
--password $PASSWORD \ | |
--user-attributes Name=email,Value=$EMAIL | |
aws cognito-idp admin-confirm-sign-up \ | |
--user-pool-id $POOL_ID \ | |
--username $EMAIL \ | |
--region $REGION | |
aws cognito-idp admin-update-user-attributes \ | |
--user-pool-id $POOL_ID \ | |
--username $EMAIL \ | |
--user-attributes Name=email_verified,Value=true | |
for attribute in "${ATTRIBUTES[@]}" ; do | |
aws cognito-idp admin-update-user-attributes \ | |
--user-pool-id $POOL_ID \ | |
--username $EMAIL \ | |
--user-attributes Name=custom:${attribute%%:*},Value=\"${attribute##*:}\" \ | |
--region $REGION | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment