Skip to main content
AWS Cognito is a fully managed identity service that provides user authentication, authorization, and user management for modern applications. It supports user pools, identity providers (IdPs), MFA, OAuth flows, and fine-grained access control. The AWSCognitoHandler provides an asynchronous, agent-friendly interface to the AWS Cognito Identity Provider (IDP) API. It is designed for automation, governance, and security workflows, enabling programmatic control over users, groups, authentication flows, MFA, and user pool configuration. The handler supports secure credential management using AWS STS role assumption and exposes Cognito operations as LLM-compatible tools.

Example

To create the AWSCognitoHandler, initialize it with AWS credentials or an IAM role. The handler automatically assumes the role (if provided) and initializes a Cognito client.

User Pool Management:

List User Pools:
Retrieves all Cognito user pools in the AWS account.
Create User Pool:
Creates a new user pool with optional policies and schema.
Describe User Pool:
Fetches metadata and configuration of a specific user pool.

User Pool Management:

Create User (Admin):
Creates a new user with a temporary password.
Get User Details:
Retrieves user attributes and status.
Enable / Disable User:
Controls user access within the pool.
Delete User:
Removes a user permanently.

Group Management:

Create Group:
Creates a new group in a user pool.
Add User to Group:
Assigns a user to a group.
List Groups:
Lists all groups in a user pool.

Authentication & Authorization:

Initiate Authentication:
Starts an authentication flow (USER_PASSWORD_AUTH, REFRESH_TOKEN_AUTH, etc.).
Respond to Auth Challenge:
Handles MFA or password challenges.
Global Sign-Out:
Signs the user out from all active sessions.

MFA & Security:

Set User MFA Preference:
Configures MFA for a user.
Verify Software Token:
Verifies an MFA token.

Identity Providers (IdP)

Create Identity Provider:
Adds an external IdP (Google, SAML, OIDC).
List Identity Providers:
Lists all configured IdPs.

Session & Resource Management:

Tag Resources:
Adds tags to a Cognito resource.
Close Handler:
Gracefully releases underlying AWS resources.