ladderlore
Request a guide
  • Type a service name, like S3 or IAM.

Service · Security, Identity, and Compliance · Builds on CLF-C02

Amazon Cognito

User pool for sign-in and tokens, identity pool for AWS credentials, and the integrations that use them.

You know from Cloud Practitioner

  • Cognito is identity for the customers of your web and mobile apps.
  • A user pool signs users in. An identity pool gives temporary AWS credentials.
  • It supports social sign-in and scales to millions of users.
Read the Cloud Practitioner lesson
  • Sign-up, sign-in, tokens for an API

    User pool
  • App uploads straight to S3

    Identity pool, after sign-in
  • Limited access for guests

    Identity pool, unauthenticated role
  • Protect an API Gateway API

    User pool authorizer
  • Require sign-in at an ALB

    ALB authenticate action with a user pool
Which Cognito feature for which need.
App user
User pool
Identity pool
S3
  1. 1The user signs in to the user pool and receives tokens.
  2. 2The app gives the token to the identity pool.
  3. 3The identity pool returns temporary AWS credentials, and the app calls S3.
From sign-in to AWS credentials.

Step by step

  1. 1The user signs in to the user pool and receives tokens.
  2. 2The app gives the token to the identity pool.
  3. 3The identity pool returns temporary AWS credentials, and the app calls S3.

From sign-in to AWS credentials.

What it is

A user pool is a directory. It handles sign-up, sign-in, MFA and password recovery. It can also take sign-ins from Google, Apple, Facebook, SAML and OIDC providers. After sign-in it returns JSON Web Tokens (JWTs): an ID token, an access token and a refresh token. A hosted sign-in page, called managed login, saves you from building screens.

An identity pool exchanges a token from a user pool, a social provider or another provider for temporary AWS credentials. It gives different IAM roles to signed-in users and to guests. This lets a mobile app upload to Amazon S3 directly.

What it is

Integrations: an Amazon API Gateway Cognito authorizer checks a user pool token before your API runs. An Application Load Balancer listener rule can authenticate users with a user pool before forwarding the request.

Remember

  • User pool: who the user is. It returns JWTs.
  • Identity pool: what the user may do in AWS. It returns temporary credentials.
  • A user pool can federate Google, Apple, Facebook, SAML and OIDC.
  • API Gateway authorizer and ALB authenticate action both use user pools.
  • Guests get an unauthenticated role through the identity pool.

Remember

  • Staff sign-in is IAM Identity Center, not Cognito.

On the exam

  • “Add sign-up and sign-in to a mobile app with social providers” points to a Cognito user pool.
  • “Mobile app users upload photos straight to S3” points to a Cognito identity pool, after user pool sign-in.
  • “Only signed-in users may call an API Gateway API” points to a Cognito user pool authorizer.