Skip to content

How to delete multiple users in bulk from AWS Cognito UserPool

0

Hello

We are using AWS Cognito for our service and need to delete a large number of users from our user pool. Manually deleting users one by one via the management console is time-consuming, so I am looking for an automated way to bulk delete users.

  1. Is there a method to delete multiple users at once in AWS Cognito?
  2. Currently, we are planning to use the AWS SDK (Python boto3) to delete users by repeatedly calling the admin_delete_user API. I would like to know if this is the best approach or if there is a more efficient method available.
  3. Are there any considerations for rate limits or performance issues when processing a large number of users? Any advice would be appreciated.

Additionally, we are considering using pagination to fetch user lists sequentially. Could you please confirm if this is the correct approach?

Thank you!

asked 2 years ago913 views

1 Answer
1
Accepted Answer

Hello.

Is there a method to delete multiple users at once in AWS Cognito?

Unfortunately, as of September 2024, there is no way to bulk delete users registered in a Cognito user pool.
Therefore, you need to create a script using SDK or AWS CLI.

Currently, we are planning to use the AWS SDK (Python boto3) to delete users by repeatedly calling the admin_delete_user API. I would like to know if this is the best approach or if there is a more efficient method available.

Yes, currently I think the only way to delete a user is to repeat the admin_delete_user API.

Are there any considerations for rate limits or performance issues when processing a large number of users? Any advice would be appreciated.

Yes, APIs such as user deletion have rate quotas.
The RPS for the admin_delete_user API is set to 25 and this value cannot be adjusted.
Therefore, if you want to delete a large number of users at once, I think it would be better to add a process that waits for a few seconds.
https://docs.aws.amazon.com/cognito/latest/developerguide/quotas.html#category_operations

EXPERT

answered 2 years ago

EXPERT

reviewed 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.