Question

Difficulty: EasyAPI Gateway Security and Authorization

A developer is securing a REST API in Amazon API Gateway. Users authenticate against an Amazon Cognito User Pool. The developer wants API Gateway to automatically validate the incoming JSON Web Tokens (JWT) before forwarding requests to the backend, with the least operational overhead.

Which two steps must the developer perform to configure this security setup? (Select TWO.)

  1. Create a Cognito User Pool authorizer in API Gateway and configure it with the user pool details.Answer
  2. Configure the API Gateway method authorization to use the newly created Cognito User Pool authorizer.Answer
  3. C
    Create a Cognito Identity Pool to issue temporary IAM credentials for signing requests using Signature Version 4.
  4. D
    Create a custom Lambda authorizer to manually decode and validate the signature of the Cognito JSON Web Token.
  5. E
    Configure a Lambda custom integration mapping template to parse authorization headers and validate JWT signatures.

Answer

Create a Cognito User Pool authorizer in API Gateway and configure the API Gateway method authorization to use it.
The correct options represent the standard path for native JWT validation with Cognito. Creating a Cognito User Pool authorizer leverages built-in functionality to automatically validate signatures, expiration, and audience of identity tokens. Configuring the API Gateway method to use this authorizer ensures the validation checks are applied to incoming requests.

Step-by-Step Solution

1
Identify the authentication source and authorization requirements.
The source is a Cognito User Pool, and token validation must happen at API Gateway with minimal custom code.
This determines that API Gateway's built-in Cognito User Pool authorizer is the optimal choice.
2
Configure the authorizer in the API Gateway console or via IaC.
A Cognito User Pool authorizer is created and pointed to the correct Cognito User Pool.
This establishes the validation connection between API Gateway and the user pool.
3
Enable authorization on the specific API resources and methods.
The method authorization settings are updated to point to the Cognito User Pool authorizer.
This enforces validation on incoming requests before they reach the backend Lambda functions.

Key Concept

API Gateway Cognito User Pool Authorizers
Rate this question