Volume 3 · Chapter 10 — Identity, Security and Compliance

Cognito and Application Identity

Goutham Mayaluri 4 min read AWSCloudSecurityCompliance

10.1 Introduction

IAM secures accesstoAWS by your workloads and workforce, but customer-facing applications need to authenticatetheir own end users- and that’s Amazon Cognito, a frequently-tested service. The critical distinction is between user pools and identity pools, and knowing when to use Cognito rather than IAM. This chapter clarifies application identity on AWS.

10.2 IAM vs Application Identity

A foundational point: IAM users and roles are foryourpeople and workloads accessing AWS - you do not create an IAM user per application customer (that doesn’t scale and isn’t its purpose). Application end users - the millions of customers of a banking app - authenticate through an application identity service like Cognito, which manages their sign-up, sign-in, and tokens, and can then broker scoped, temporary AWS access if the app needs it. Recognizing that “app users are not IAM users” and that Cognito (or a similar IdP) handles them is a common exam distinction.

10.3 User Pools vs Identity Pools

Cognito has two components with different jobs. AUser Poolis a user directory that handlesauthentication- sign-up and sign-in, MFA, password policies, account recovery, and federation to social/enterprise IdPs - and issues JWT tokens the app uses; it’s how you get “who is this user, and are they authenticated.” AnIdentity Pool(federated identities) handlesauthorization to AWS- it exchanges a token (from a User Pool or an external IdP like Google) fortemporary AWS credentialsvia an IAM role, so authenticated (or even guest) users can directly access AWS resources (e.g. upload to an S3 prefix). The exam mnemonic:User Pool = authentication(a user directory issuing tokens),Identity Pool = authorization(exchanging tokens for temporary AWS credentials). They’re often used together - authenticate with a User Pool, then use an Identity Pool to grant AWS access.

flowchart LR
  User((App user)) --> UP[Cognito User Pool - sign-up/sign-in, MFA, tokens]
  UP -->|JWT token| App[App]
  App -->|token| IP[Cognito Identity Pool]
  IP -->|exchange for| Creds[Temporary AWS credentials via IAM role]
  Creds --> AWS[(Direct scoped access e.g. S3, DynamoDB)]

10.4 When to Use Cognito

Use Cognito when you need to manage authentication and authorization for a web or mobile application’s end users at scale, with sign-up/sign-in, MFA, social and enterprise federation, and optional direct-to-AWS access - without building your own identity system or misusing IAM. It integrates with API Gateway (as an authorizer) and AppSync to secure APIs with Cognito tokens. For internal workforce access to AWS you’d use IAM Identity Center instead; Cognito is specifically forapplicationusers. This clear split - Cognito for app/ customer identity, IAM/Identity Center for AWS access by your org - is what the exam tests.

10.5 Banking Production Scenario

A bank’s mobile and web banking apps authenticate customers through a Cognito User Pool - handling sign-up, sign-in, MFA, password policies, and federation so customers can also use a social or corporate login - and the User Pool issues JWT tokens. API Gateway uses a Cognito authorizer to validate those tokens on every API call. Where a feature lets customers upload documents directly to their own S3 prefix, a Cognito Identity Pool exchanges the token for temporary AWS credentials scoped by an IAM role to just that user’s prefix. Bank employees, by contrast, access the AWS console and services through IAM Identity Center, not Cognito. This clean separation of customer identity (Cognito) from workforce identity (Identity Center) is exactly the design the certification expects for applications that serve external users.

10.6 Chapter Revision Notes

  • App/customer end users are not IAM users - IAM is for your workforce and workloads; use Cognito (or another IdP) for application users.
  • Cognito User Pool = authentication (user directory: sign-up/sign-in, MFA, federation, issues JWT tokens).
  • Cognito Identity Pool = authorization to AWS (exchanges a token for temporary AWS credentials via an IAM role).
  • They’re often combined: authenticate with a User Pool, then get AWS access via an Identity Pool; User Pools integrate with API Gateway/AppSync authorizers.
  • Cognito for application users; IAM Identity Center for workforce AWS access.