DVA-C02

Introduction to Amazon Cognito

User sign-up, sign-in and access control for web and mobile apps.

  • 2 lessons
  • Module quiz

Most web and mobile applications need users to sign up and sign in, and many need those users to access AWS resources, for example to upload a photo to Amazon S3. Building this securely is difficult: passwords must be stored safely, multi-factor authentication and password resets must work, social and corporate sign-in must be supported, and AWS credentials must never be embedded in an app that runs on users' devices.

Amazon Cognito provides these capabilities as a managed service with two main parts. A user pool is a user directory that signs users up and in and issues JSON Web Tokens (JWTs), namely an ID token, an access token and a refresh token, that prove who the user is. An identity pool exchanges a token for temporary AWS credentials, so the app can call AWS services directly with permissions limited to that user. Cognito is charged per monthly active user, with a free tier.

Where Cognito fits

The distinction between the two parts is the most frequently tested point: a user pool answers "who is the user?" (authentication), while an identity pool answers "what AWS resources may they access?" (authorisation to AWS). Applications often use both. User pool tokens are also used to protect APIs, through Cognito user pool authorizers in API Gateway and authorisation modes in AWS AppSync.

How this module is organised

Authenticating Users with Amazon Cognito User Pools explains sign-up and sign-in, the tokens a user pool issues and how APIs validate them. Granting AWS Credentials to App Users with Amazon Cognito Identity Pools explains how tokens are exchanged for AWS credentials and how policies limit each user to their own resources.

  1. Authenticating Users with Amazon Cognito User Pools Lesson 1
  2. Granting AWS Credentials to App Users with Amazon Cognito Identity Pools Lesson 2
  3. Practise and review
  4. Test your knowledge 6 questions