I'm developing a React Native app and using AWS Amplify with Amazon Cognito for authentication. I've added the authentication for the app using Amplify CLI (amplify add auth
). The problem is I need to add/remove the required attributes for the sign up, but those cannot be changed after the user pool is created.
My question is how can I delete the currently added user pool using the CLI, and making sure that the changes are reflected in aws-exports.js
?
You must have jq installed and remember to make the script executable: chmod +x deleteAllUsers.sh . The user pool id can be provided as a command line argument: ./deleteAllUsers.sh COGNITO_USER_POOL_ID . Thanks, this is perfect.
Short description. You can't change standard user pool attributes after a user pool is created. Instead, create a new user pool with the attributes that you want to require for user registration. Then, migrate existing users to the new user pool by using an AWS Lambda function as a user migration trigger.
I figured it out. As mentioned here, it's not in amplify-cli
docs, but you can remove a single category (in this case auth
) like this:
amplify remove <category>
So, in this case, it would be
amplify remove auth
And, then
amplify push
aws cognito-idp delete-user-pool --user-pool-id youruserpoolid
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With