Skip to content

Instantly share code, notes, and snippets.

@sonufrienko
Last active July 12, 2022 03:45
Show Gist options
  • Save sonufrienko/ba724061be7163acbdca6a705017ddba to your computer and use it in GitHub Desktop.
Save sonufrienko/ba724061be7163acbdca6a705017ddba to your computer and use it in GitHub Desktop.
Useful AWS CLI commands
export AWS_COGNITO_REGION=
export AWS_COGNITO_USERPOOL_ID=
export AWS_COGNITO_CLIENT_ID=
export AWS_COGNITO_USERNAME=
export AWS_COGNITO_PASSWORD="
# Cognito change password
aws cognito-idp respond-to-auth-challenge \
--region $AWS_COGNITO_REGION \
--client-id $AWS_COGNITO_CLIENT_ID \
--challenge-name NEW_PASSWORD_REQUIRED \
--challenge-responses NEW_PASSWORD=$AWS_COGNITO_PASSWORD,USERNAME=$AWS_COGNITO_USERNAME \
--session XXX
# Sets the specified user's password in a user pool as an administrator
aws cognito-idp admin-set-user-password \
--user-pool-id $AWS_COGNITO_USERPOOL_ID \
--region $AWS_COGNITO_REGION \
--username $AWS_COGNITO_USERNAME \
--password $AWS_COGNITO_PASSWORD \
--permanent
# Login with username/password
aws cognito-idp initiate-auth \
--region $AWS_COGNITO_REGION \
--client-id $AWS_COGNITO_CLIENT_ID \
--auth-flow USER_PASSWORD_AUTH \
--auth-parameters USERNAME=$AWS_COGNITO_USERNAME,PASSWORD=$AWS_COGNITO_PASSWORD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment