**To list the groups in a user pool**

The following ``list-groups`` example lists the first two groups in the requested user pool. ::

    aws cognito-idp list-groups \
        --user-pool-id us-west-2_EXAMPLE \
        --max-items 2

Output::

    {
        "Groups": [
            {
                "CreationDate": 1681760899.633,
                "Description": "My test group",
                "GroupName": "testgroup",
                "LastModifiedDate": 1681760899.633,
                "Precedence": 1,
                "UserPoolId": "us-west-2_EXAMPLE"
            },
            {
                "CreationDate": 1642632749.051,
                "Description": "Autogenerated group for users who sign in using Facebook",
                "GroupName": "us-west-2_EXAMPLE_Facebook",
                "LastModifiedDate": 1642632749.051,
                "UserPoolId": "us-west-2_EXAMPLE"
            }
        ],
        "NextToken": "[Pagination token]"
    }

For more information, see `Adding groups to a user pool <https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-pools-user-groups.html>`__ in the *Amazon Cognito Developer Guide*.
