How to configure credential caching for WebSocket APIs?

A developer has an application that uses WebSocket APIs in Amazon API Gateway. The developer wants to use an API Gateway Lambda authorizer to control access to the application. The developer needs to add credential caching and reduce repeated usage of secret keys and authorization tokens on every request. Which combination of steps should the developer take to meet these requirements? (Choose two.)

  1. Use a token-based Lambda authorizer. Source Reference Answer
  2. Use a request parameter-based Lambda authorizer.
  3. Configure an integration request mapping template to reference the context map from the APIGateway Lambda authorizer. Source Reference Answer
  4. Configure an integration request mapping template to reference the identity API key value from the API Gateway Lambda authorizer.
  5. Use VPC endpoint policies for the WebSocket APIs.

Community Votes

AC
67%
BC
33%

67% of anonymous learners picked answer AC. Votes are pick records left by other test-takers — they are not the verified answer.

Community Insight

The exam tests the ability to select the correct Lambda authorizer type for caching (token-based) and the method to propagate authorization results (context map) to the backend integration.

To implement credential caching and minimize repeated secret usage in Amazon API Gateway WebSocket APIs, developers should utilize a token-based Lambda authorizer and pass the authorization context to the backend via integration mapping templates.

Selecting a request parameter-based authorizer (Option B) instead of a token-based one, often due to confusion over caching capabilities, despite the question specifically mentioning 'authorization tokens.'

Community Discussion (4 comments)

0bdf3af 👍 1 Selected: BC
https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-websocket-api-lambda-auth.html
albert_kuo 👍 1 Selected: BC
Request parameter-based Lambda authorizers are indeed more suitable and the recommended approach. After authorization, you can use the context map to pass relevant information to your backend without re-evaluating credentials for each message.
Mo_1981 👍 3 Selected: AC
Answers A,C
catoteja 👍 1 Selected: AC
It's A C.

Comments & Corrections

No comments yet — spotted an error or have a note? Share it below.

Log in to comment, report an error, or add a note about this question.

Submitted for moderation before publishing. Keep it helpful and respectful.

Expert Analysis

Why the Answer Is Correct

Option A is correct because token-based Lambda authorizers are specifically designed to receive an authorization token (e.g., JWT) and cache the resulting policy. This caching mechanism significantly reduces the need to re-evaluate credentials or invoke the Lambda function for every request containing the same token. Option C is correct because the integration request mapping template is the mechanism used to extract data from the $context.authorizer object (populated by the authorizer) and pass it to the backend, allowing the application to function without handling raw secret keys repeatedly.

Why the Other Options Are Wrong

Option B is incorrect because while request parameter-based authorizers support caching, the question specifically references 'authorization tokens,' making the token-based approach the direct and intended solution for this terminology. Option D is incorrect because referencing the API key value is unrelated to the context map output of a Lambda authorizer used for passing user identity or claims. Option E is incorrect because VPC endpoint policies control network access to the API, not the application-level authorization logic or caching.

Community Comment Notes

There is some community debate regarding whether request parameter-based authorizers (Option B) are superior, as noted in comments [1] and [2]. However, the majority consensus (67% votes) and the specific mention of 'authorization tokens' in the prompt validate the selection of the token-based authorizer (Option A). Comment [4] confirms the A and C combination, aligning with the standard AWS documentation for passing authorizer context.

Official Reference

Exam Strategy

When questions mention 'authorization tokens' or 'credential caching' with API Gateway, immediately look for 'Token-based Lambda authorizer' and 'Context map' references to ensure the backend receives the necessary identity data without re-processing secrets.

Related Analysis

Practice All DVA-C02 Questions

Access 100 questions with complete answers and detailed explanations.

View Full DVA-C02 Practice Test →

← Back to DVA-C02 Study Guide