'List Cognito Users in AWS

I am trying to list all cognito users from my Cognito AWS service, I am trying to get the users pool id and I am taking it from here (please mind following image attached): enter image description here

as I am using the following code (and taking the Pool Id from the image above):

public class AwsClient {
    private AWSCognitoIdentityProvider identityProvider;
    private final static String AWS_USER_POOL_ID = "<USER_POOL_ID>";

    public AwsClient(String regionName){
        AWSStaticCredentialsProvider provider = new AWSStaticCredentialsProvider(new BasicAWSCredentials(System.getenv("AWS_ACCESS_KEY_ID"),
                System.getenv("AWS_SECRET_ACCESS_KEY")));

        this.identityProvider = AWSCognitoIdentityProviderClientBuilder.standard().withCredentials(provider)
                .withRegion(Regions.US_EAST_1).build();
        ListUsersRequest req = new ListUsersRequest();
        req = req.withUserPoolId(AWS_USER_POOL_ID);
        ListUsersResult response = identityProvider.listUsers(req);

    }

I am getting the following error message:

User pool us-east-1_qvWp8iA5f does not exist.

What could be the problem?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source