avatar
find users in Cognito User pool by custom attribute CLI

» First and foremost, let set up your AWS credentials and session token for using AWS services via the AWS CLI tool.

SET AWS_ACCESS_KEY_ID=XXXXX
SET AWS_SECRET_ACCESS_KEY=XXXXXXX
SET AWS_SESSION_TOKEN=XXXXXXXXXXXXX

» The next step, update the AWS CLI configuration file with the specified region, and subsequent AWS CLI commands will use that region for their operations.

aws configure set region <your region>
aws configure get region

» Finally, execute the command to list users in your Cognito user pool based on a specific custom attribute.

aws cognito-idp list-users --user-pool-id <Your User Pool> --query "Users[?contains(Attributes[?Name=='custom:PetName'].Value, 'Dog')]"
You need to login to do this manipulation!