Cognito user pools vs identity pools: which do you need
A user pool answers who the user is. It is a user directory and OpenID Connect identity provider that signs users in and issues JSON web tokens. An identity pool answers which AWS resources the user may reach. It exchanges a trusted token for temporary, limited-privilege AWS credentials. Use both when users sign in and then call AWS services such as S3 directly.
User pools
A user pool stores user profiles and authenticates users. Users can sign in directly, or federate through social providers such as Google and Apple, or through enterprise SAML 2.0 and OIDC providers. Whatever the provider, the user pool issues your app one standard set of tokens, so the app handles one token format.
User pools also provide managed sign-in pages, MFA with SMS or TOTP, groups, custom user attributes and token customization. The ID token tells your app who signed in. The access token authorizes calls to your own APIs, for example through an API Gateway authorizer.
A user pool does not need an identity pool. If your app only calls your own API, the user pool's tokens are enough.
Identity pools
An identity pool takes proof of sign-in and returns temporary AWS credentials from AWS STS. It accepts tokens from a user pool, from social providers, from SAML and OIDC providers, and from your own developer-authenticated identities. It can also give limited credentials to guest users who have not signed in.
It controls permissions in two ways. With role-based access control, Cognito picks the IAM role from a default role, from rules over the user's claims, or from the user's group in a user pool. With attributes for access control, it maps claims to session tags, and your policies check aws:PrincipalTag. For example, a session tagged Department: marketing can read a bucket whose policy requires that tag, with no extra role per department.
An identity pool does not need a user pool. It can broker credentials for a provider you already have.
Using both together
The documented flow has three steps. The user signs in through the user pool and receives tokens. The app exchanges a user pool token at the identity pool for temporary AWS credentials. The app uses those credentials to call services such as Amazon S3 and DynamoDB directly from the device.
Where the exam catches people
Believing a user pool token can sign requests to S3: AWS credentials come from an identity pool, so exchange the token there first.
Believing an identity pool is a user directory: the user pool stores profiles, and the identity pool issues AWS credentials.
Believing an app that only calls its own API needs an identity pool: the user pool's tokens can authorize that API.
Believing per-department access needs one IAM role per department: attributes for access control map a claim to a session tag that policies can check.
Believing every identity pool user must sign in: an identity pool can issue limited credentials to unauthenticated guests.