Question

Difficulty: MediumApplication Authentication and Authorization with Amazon Cognito

A developer is building a mobile application that requires users to authenticate before they can upload files directly to a private Amazon S3 bucket. The application must support user registration and sign-in, and provide temporary, limited-privilege AWS credentials to authenticated users for S3 uploads. Which combination of Amazon Cognito features should the developer use to meet these requirements with the least operational overhead?

  1. Authenticate users using a Cognito User Pool, and then exchange the user pool tokens for temporary credentials using a Cognito Identity Pool.Answer
  2. B
    Authenticate users using a Cognito Identity Pool to generate JSON Web Tokens (JWTs), and use the Identity Pool's user directory to store user attributes.
  3. C
    Authenticate users using a Cognito User Pool, and use a custom API Gateway Lambda authorizer to exchange User Pool tokens for temporary AWS credentials.
  4. D
    Authenticate users using a Cognito User Pool, and configure the User Pool's trust policy to allow the mobile application to directly assume an IAM role.

Answer

Authenticate users using a Cognito User Pool, and then exchange the user pool tokens for temporary credentials using a Cognito Identity Pool.
The correct architecture uses a Cognito User Pool for user sign-in and directory management (authentication) and a Cognito Identity Pool to exchange those identity tokens for temporary, limited-privilege AWS credentials to access S3 (authorization). This is the standard, low-overhead pattern recommended by AWS.

Step-by-Step Solution

1
Identify authentication requirement.
Amazon Cognito User Pools are selected to manage user sign-up, sign-in, and directory storage.
User Pools act as the Identity Provider (IdP) to authenticate users and issue JSON Web Tokens (JWTs).
2
Identify authorization requirement for AWS resources (S3).
Amazon Cognito Identity Pools (Federated Identities) are selected to exchange identity tokens for temporary AWS credentials.
Identity Pools map authenticated user identities to IAM roles, allowing direct and secure access to AWS services like S3.

Key Concept

Separation of concerns between Cognito User Pools (authentication/directory) and Cognito Identity Pools (authorization/temporary credentials).
Rate this question