Last active
June 28, 2021 20:27
-
-
Save billjohnston/dcb601599caa70c77302752c716c8f80 to your computer and use it in GitHub Desktop.
Cognito CSV user import
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
IMPORT_NAME="cognito_import_test" | |
CSV_PATH="/full/path/to/importTest.csv" | |
USER_POOL_ID="asdfasdfasdf" | |
CLOUDWATCH_ROLE_ARN="arn:aws:iam::469973828956:role/CognitoStack-CognitoImportRole95D37A15-20RNO02KSGD5" | |
REGION="us-east-1" | |
JOB_DETAILS=$(aws cognito-idp create-user-import-job --job-name "${IMPORT_NAME}" --user-pool-id "${USER_POOL_ID}" --cloud-watch-logs-role-arn "${CLOUDWATCH_ROLE_ARN}" --region "${REGION}" --profile CognitoService) && \ | |
PRE_SIGNED_URL=$(jq -r '.UserImportJob.PreSignedUrl' <<< "${JOB_DETAILS}") && \ | |
JOB_ID=$(jq -r '.UserImportJob.JobId' <<< "${JOB_DETAILS}") && \ | |
curl -v -T "${CSV_PATH}" -H "x-amz-server-side-encryption:aws:kms" "${PRE_SIGNED_URL}" && \ | |
aws cognito-idp start-user-import-job --user-pool-id "${USER_POOL_ID}" --job-id "${JOB_ID}" --region "${REGION}" --profile CognitoService |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment