How does serverless identity with Amazon Cognito work?
Learn user pools, identity pools, tokens, federation, API authorization, tenant boundaries, and secure identity flows for web and mobile applications.
How does serverless identity with Amazon Cognito work?
Amazon Cognito provides managed identity capabilities for applications. User pools act as user directories and issue tokens for authentication, while identity pools can exchange authenticated or guest identities for temporary AWS credentials; these are separate capabilities and should be chosen only when the application needs them.
How this topic fits
Security
Apply least privilege, workload identity, authentication, secret handling, encryption, auditability, and secure service boundaries.
Separate authentication from authorization
Authentication establishes who the caller is. Authorization decides what that identity can do in this application and resource context. A valid token proves an authentication result but does not by itself enforce tenant ownership or every domain rule.
Validate issuer, audience or client, signature, expiration, token use, and required scopes or claims at the API boundary. Then apply resource-level authorization before accessing data or causing side effects.
Use user pools and identity pools for different needs
A user pool manages sign-up, sign-in, federation, account recovery, tokens, and related directory features. An identity pool is used when clients need temporary AWS credentials mapped to authenticated or unauthenticated identities.
Many applications need a user pool but not an identity pool because clients call an API rather than AWS services directly. Add direct AWS credentials only for a concrete access pattern and tightly scoped role policy.
Design the complete account lifecycle
Cover registration, verification, sign-in, multifactor authentication, federation, refresh, sign-out, recovery, email or phone changes, account disablement, deletion, and support intervention. Abuse controls and rate limits belong in the same design.
Avoid putting rapidly changing authorization state only in long-lived token claims. Define how role or tenant changes take effect and how sessions are revoked or constrained after a security event.
Enforce tenant and resource boundaries in data access
Derive trusted identity from validated credentials, never from an unverified request field. Bind database keys, object prefixes, queue operations, and business rules to that trusted context.
Log security-relevant actions without storing tokens or sensitive claims. Test cross-user and cross-tenant denial cases, confused-deputy paths, deleted accounts, stale sessions, and administrator operations.
Go deeper with AWS
Read the primary AWS documentation behind the service definitions and architecture guidance in this guide.
Next steps
Continue with the concepts that most directly shape this decision.
What is a serverless API?
Understand the request path, authentication, routing, compute, data, throttling, observability, and failure controls behind a serverless API on AWS.
IAM for serverless applications
Understand execution roles, resource policies, caller identity, least privilege, service-to-service access, permission boundaries, and audit trails.
Questions about this topic
Browse all serverless concepts
Explore compute, APIs, events, workflows, data, security, reliability, operations, delivery, and AI from one connected AWS serverless learning path.
What is serverless?
Learn what serverless computing means, how it works on AWS, what the cloud provider manages, and which trade-offs still belong to your team.
What is AWS Lambda?
Understand how AWS Lambda runs code, how functions are invoked, where permissions and state live, and when Lambda is a good compute choice.
What is serverless architecture?
Learn how managed compute, APIs, events, queues, workflows, data, identity, and observability fit together in a serverless architecture on AWS.
AWS serverless security
A practical guide to identity, least privilege, event validation, secrets, data protection, dependencies, and incident visibility in AWS serverless systems.
What is agentic AI?
Learn what makes an AI system agentic, how models, tools, memory, orchestration, identity, and evaluation fit together, and where serverless patterns help on AWS.
What is cloud computing?
Understand how on-demand infrastructure and managed services change the way teams provision, scale, pay for, and operate software systems.
What is event-driven architecture?
Learn how producers, routers, and consumers communicate through events, and how to design schemas, delivery, retries, and ownership deliberately.
What is a serverless API?
Understand the request path, authentication, routing, compute, data, throttling, observability, and failure controls behind a serverless API on AWS.
What are serverless workflows?
Learn when explicit workflow state improves retries, branching, parallel work, human approval, visibility, and recovery in distributed applications.
What is Amazon API Gateway?
Learn how API Gateway creates, publishes, secures, monitors, and operates HTTP, REST, and WebSocket APIs for AWS and external backends.
What is Amazon EventBridge?
Understand EventBridge event buses, rules, pipes, schemas, targets, schedules, permissions, delivery, and recovery in event-driven AWS systems.
Make the next serverless decision explicit.
Explore focused products for repeatable work, or bring the architecture decision that needs context and experienced review.