Study guide

6.4 Amazon Cognito and Identity Federation

AWS Solutions Architect Associate SAA-C03

Track your progress as you read

Finished sections get a check mark.

1 Introduction

About the AWS Solutions Architect Associate (SAA-C03) Exam Study Strategies and Exam Tips for SAA-C03 The AWS Well-Architected Framework

2 Domain 1: Design Secure Architectures (30%)

1.1 IAM Fundamentals — Users, Groups, Roles, and Policies 1.2 AWS Organizations, SCPs, and Multi-Account Strategy 1.3 VPC Security — Security Groups, NACLs, and VPC Endpoints 1.4 Encryption, KMS, and Secrets Management 1.5 AWS WAF, Shield, and Network Firewall 1.6 GuardDuty, Inspector, Macie, and Security Hub 1.7 The Shared Responsibility Model for Solutions Architects 1.8 Data Protection, Compliance, and Audit Services

3 Domain 2: Design Resilient Architectures (26%)

2.1 Elastic Load Balancing (ELB) — ALB, NLB, and GWLB 2.2 EC2 Auto Scaling — Dynamic, Predictive, and Scheduled 2.3 Multi-AZ and Multi-Region Architectures 2.4 Disaster Recovery Strategies — RTO and RPO 2.5 Decoupling with SQS, SNS, and EventBridge 2.6 AWS Step Functions and Workflow Orchestration

4 Domain 3: Design High-Performing Architectures (24%)

3.1 EC2 Instance Types, Purchasing Options, and Placement Groups 3.2 Lambda, Serverless Compute, and Container Services 3.3 Amazon S3 - Storage Classes, Lifecycle, and Performance 3.4 Block and File Storage - EBS, EFS, and FSx 3.5 Database Services - RDS, Aurora, DynamoDB, and More 3.6 CloudFront, Route 53, and Global Accelerator 3.7 Data Ingestion and Transformation - Kinesis, Glue, and EMR

5 Domain 4: Design Cost-Optimized Architectures (20%)

4.1 Compute Cost Optimization — Right-Sizing, RIs, Savings Plans, and Spot 4.2 Storage Cost Optimization — S3 Tiers, EBS, and Data Transfer 4.3 Database Cost Optimization 4.4 AWS Cost Management and Monitoring Tools

6 VPC and Networking Deep Dive

5.1 VPC Architecture — Subnets, Route Tables, and Gateways 5.2 VPC Connectivity — Peering, Transit Gateway, and Direct Connect 5.3 Amazon API Gateway 5.4 CloudFormation and Infrastructure as Code 5.5 AWS PrivateLink and Endpoint Services

7 Migration, Transfer, and Hybrid Services

6.1 The 7 Rs of Cloud Migration 6.2 AWS Snow Family — Snowball Edge Devices 6.3 CloudWatch, CloudTrail, and AWS Config 6.4 Amazon Cognito and Identity Federation 6.5 AWS DataSync and Transfer Family

8 Serverless Architecture and Application Services

7.1 Serverless Architecture Patterns 7.2 Advanced SQS Patterns — DLQ, Backpressure, and FIFO 7.3 Analytics Services — Athena, OpenSearch, and QuickSight 7.4 Container Orchestration — ECS, EKS, and ECR

9 Advanced Topics and Exam Scenarios

8.1 Advanced IAM — Permission Boundaries, Federation, and Cross-Account 8.2 Caching Strategies and ElastiCache Patterns 8.3 Hybrid Architecture — DNS, Storage, and Compute 8.4 SAA-C03 Scenario Practice — Putting It All Together

6.4 Amazon Cognito and Identity Federation

Key Takeaways Explain This Topic AI

Cognito User Pools are a managed user directory for sign-up/sign-in that returns JWT tokens (ID, access, refresh) — they handle authentication ('who are you?').

Cognito Identity Pools exchange a trusted token for temporary AWS credentials via STS, mapping users to IAM roles — they handle authorization to AWS services ('what can you access?').

User Pools support social providers (Google, Facebook, Apple, Amazon), SAML 2.0, and OIDC, plus MFA, hosted UI, and Lambda triggers for custom auth logic.

For browser/mobile clients writing directly to AWS, combine both: the User Pool authenticates, the Identity Pool issues scoped temporary credentials restricted to the user's own resources.

Use IAM Identity Center (formerly AWS SSO) with SAML for workforce single sign-on to the AWS Console across many accounts — not Cognito, which targets customer-facing applications.

Last updated: June 2026

Cognito User Pools — Authentication

Quick Answer: User Pools = a hosted user directory that signs people in and returns JWT tokens . Identity Pools (a.k.a. federated identities) = swap a trusted token for temporary AWS credentials so a client app can call S3, DynamoDB, etc. Used together: User Pool authenticates → Identity Pool authorizes direct AWS access. The exam tests when you need one, the other, or both.

A User Pool is a fully managed directory handling registration, sign-in, password policy, MFA, and account recovery for customer-facing apps.

  • Feature Detail
  • Sign-in methods Username, email, or phone with password
  • Social federation Google, Facebook, Apple, Amazon
  • Enterprise federation SAML 2.0 and OIDC identity providers
  • MFA SMS or TOTP authenticator app; adaptive (risk-based) MFA
  • Tokens Returns ID token (identity claims), access token (scopes), refresh token — all JWTs
  • Hosted UI AWS-hosted, brandable sign-in/sign-up pages
  • Lambda triggers Custom logic at pre/post sign-up, pre/post authentication, token generation
  • Advanced security Compromised-credential and impossible-travel detection
  • Pattern: User Pool + API Gateway (no AWS creds needed)

When a client only needs to call your API (not AWS services directly), the User Pool alone suffices:

User signs in to the User Pool and receives a JWT.

The client sends the JWT in the Authorization header on each request.

API Gateway uses a Cognito authorizer to validate the token signature, issuer, and expiry.

Valid requests reach the backend Lambda; invalid ones get a 401.

This pattern needs no Identity Pool , because the client never touches AWS APIs directly — a frequent distractor on the exam.

  • Identity Pools and Federation Choices
  • Cognito Identity Pools — temporary AWS credentials

An Identity Pool trades a verified token (from a User Pool, a social IdP, SAML, or OIDC) for temporary AWS credentials via AWS STS, then maps the caller to an IAM role .

  • Aspect Detail
  • Input Token from User Pool / Google / Facebook / SAML / OIDC
  • Output Temporary access key, secret key, session token
  • Role mapping Separate roles for authenticated vs optional guest (unauthenticated) users
  • Fine-grained access Policy variables scope users to their own data

Worked example — per-user S3 isolation: A photo app lets each user upload to only their own prefix. Configure the authenticated role with an S3 policy condition using ${cognito-identity.amazonaws.com:sub} so the principal can read/write only arn:aws:s3:::app-bucket/users/${cognito-identity.amazonaws.com:sub}/* . The client never holds long-lived keys; credentials expire and refresh automatically.

Choosing the right federation service

  • Need Service
  • Customer app sign-up/sign-in Cognito User Pool
  • Client app needs direct AWS access Cognito Identity Pool
  • Workforce SSO to AWS Console across accounts IAM Identity Center (SAML)
  • Legacy social login mapped to AWS Web identity federation (largely via Identity Pools now)
  • Decision flow

Does the client call only your own API? → User Pool + API Gateway authorizer .

Does the client call AWS services directly (S3, DynamoDB)? → User Pool + Identity Pool .

Are these employees logging into the AWS Console/CLI? → IAM Identity Center , not Cognito.

Common trap: Picking Cognito for employee console SSO. Cognito is built for customer-facing apps; workforce console SSO across multiple accounts is IAM Identity Center with SAML to Active Directory.

On the Exam: "Mobile app uploads photos directly to each user's own S3 folder" → User Pool (auth) + Identity Pool (temporary creds) + S3 policy scoped by identity. "Validate JWTs on a REST API" → User Pool + API Gateway authorizer (no Identity Pool).

Tokens, scale, and security details worth knowing

A User Pool issues three JWTs with distinct jobs: the ID token carries identity claims (email, name) for your app, the access token carries OAuth scopes used to authorize API calls, and the refresh token (valid far longer) silently obtains new ID and access tokens so users are not forced to re-authenticate. Access and ID tokens default to a one-hour lifetime, which is why refresh-token handling matters in mobile apps. User Pools scale to tens of millions of users and integrate MFA and adaptive authentication that raises the challenge when sign-in risk looks high (new device, impossible travel).

Common architecture and design pitfalls

For server-side web apps that already authenticate users another way, you may not need Cognito at all — but for greenfield customer apps, Cognito removes the burden of building secure password storage, recovery, and federation yourself. A frequent design pitfall is granting the Identity Pool's authenticated role overly broad permissions; always scope it with policy variables (such as the Cognito identity sub ) so one user cannot read another's data. Another pitfall is using guest (unauthenticated) access without realizing those anonymous credentials still map to a real IAM role — lock that role down tightly or disable guest access.

Finally, remember that SAML and OIDC providers can plug into a User Pool (so corporate users sign in through your app's hosted UI), whereas console SSO for staff belongs to IAM Identity Center; mixing these two up is the single most common Cognito mistake on the exam.