Install
openclaw skills install aws-cognitoUse this skill for ANY task involving AWS Cognito — user pools, identity pools, authentication flows, token handling, social/enterprise federation, MFA, Lambda triggers, hosted UI, or Cognito integration with API Gateway, AppSync, S3, DynamoDB, Amplify, or any AWS service. Trigger whenever the user mentions "Cognito", "user pool", "identity pool", "auth flow", "social login with AWS", "JWT tokens from AWS", "hosted UI", "managed login", "Cognito triggers", "OAuth with Cognito", "SAML federation", "MFA setup", "sign-up/sign-in", "password policy", "Cognito CDK", "Cognito CloudFormation", "Cognito Terraform", "Cognito SDK", "aws-amplify auth", "token refresh", "Cognito groups", "RBAC with Cognito", or any authentication/authorization task that could involve AWS Cognito — even if they don't name Cognito explicitly but describe a pattern it solves (e.g. "I need user auth for my AWS app").
openclaw skills install aws-cognitoThis skill helps you build, configure, debug, and manage AWS Cognito resources — user pools, identity pools, app clients, Lambda triggers, federation, and integrations with other AWS services.
references/setup-guide.md, then follow the setup workflowreferences/iac-patterns.md for production-ready templatesreferences/auth-flows.md for SDK code and flow selectionreferences/troubleshooting.md for common issues and fixesreferences/lambda-triggers.md for trigger patternsreferences/security.md for best practicesRead the relevant reference file(s) before generating any code or configuration. Multiple files may apply — for example, a new CDK setup would benefit from both setup-guide.md and iac-patterns.md.
These are the two main Cognito components and they serve different purposes:
A common architecture uses both: User Pool authenticates the user and issues tokens → Identity Pool exchanges those tokens for AWS credentials → User accesses S3, DynamoDB, etc.
As of late 2024, Cognito uses feature plans instead of the old "advanced security" toggle:
Always ask the user which plan they need, or default to Essentials for new setups.
Before writing any code, determine:
Based on requirements, determine:
Read the appropriate reference files and generate code. Always:
aws-cdk-lib/aws-cognito) — never CDK v1@aws-sdk/client-cognito-identity-provider) — never v2aws-amplify) patternsRemovalPolicy.RETAIN on user pools in production (data loss prevention)Before declaring done, verify against references/security.md:
Use a Cognito User Pool Authorizer on API Gateway. The access token is validated automatically. Scopes in the token control which API methods are accessible.
Configure AMAZON_COGNITO_USER_POOLS authorization on your GraphQL API. Use @auth directives in your schema for fine-grained access control.
User Pool → Identity Pool → IAM role with S3 permissions scoped to ${cognito-identity.amazonaws.com:sub}/* for per-user folders.
Use CUSTOM_AUTH flow with Define, Create, and Verify Auth Challenge triggers for passwordless (magic link, OTP) or multi-step authentication.
Use Client Credentials grant with a resource server and custom scopes. No user interaction — one app authenticating to another.
custom: (e.g., custom:company).sub attribute is the unique, immutable user identifier. Use it as your primary key, not email or username.