Introduction

Amazon Cognito contains two components that are frequently confused, the user pool and the identity pool. They solve different problems. A user pool confirms who a user is, and an identity pool grants an application temporary access to AWS services. This guide compares the two and explains when each should be used. A general overview is provided in the guide on what Amazon Cognito is.

What is being compared?

A user pool is concerned with authentication, which is the confirmation of a user's identity. It manages registration and sign-in and issues tokens. An identity pool is concerned with access to AWS resources. It takes an identity that has already been proven, whether by a user pool or by an external provider, and returns temporary AWS credentials that are limited by a permission policy.

Why the distinction matters

Because the two components have similar names, the wrong one is often selected. A design that requires only sign-in does not need an identity pool, and a design that must call AWS services directly cannot rely on a user pool alone. Understanding the distinction prevents unnecessary complexity and avoids security gaps.

How each works

A user pool receives a registration or sign-in request, verifies the credentials, and issues an ID token, an access token, and a refresh token. These tokens are used to prove the identity of the user to an application or an API.

An identity pool receives an identity, either the token from a user pool or an assertion from an external provider, and returns temporary AWS credentials. These credentials are governed by an IAM role, which is a set of permissions defined in AWS Identity and Access Management. The credentials expire after a short period, which limits the risk if they are exposed.

Comparison diagram

User pool (authentication) Identity pool (AWS access) sign-in credentials a proven identity | | v v verifies the user exchanges the identity for | temporary AWS credentials v | issues ID, access, and v refresh tokens limited by an IAM role, expires after a short time

What a user pool provides

What an identity pool provides

When to use each

Best practices

Common mistakes

Further reading in this library

Frequently Asked Questions

What does a user pool do?
A user pool is a user directory that manages sign-up and sign-in and issues tokens that prove who a user is. Its purpose is authentication.
What does an identity pool do?
An identity pool exchanges a proven identity for temporary AWS credentials that are limited by a permission policy. Its purpose is controlled access to AWS services.
Are both always required?
No. Many applications need only a user pool. An identity pool is required only when the application must access AWS services directly with temporary credentials.
Can they be used together?
Yes. A user pool can authenticate the user, and the resulting identity can then be passed to an identity pool to obtain temporary AWS credentials.
Can an identity pool be used without a user pool?
Yes. An identity pool can accept identities from external providers, so it can grant AWS credentials without a Cognito user pool.
AWS Cognito book cover
Go deeper ยท Book as a Service™
AWS Cognito

This article is the summary. The book is the full, continuously updated reference: user pools, identity pools, federated access, IAM roles, and real-world integration.

View the book