DVA-C02 · Question #423
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…
The correct answer is A. Use a token-based Lambda authorizer. C. Configure an integration request mapping template to reference the context map from the. A token-based Lambda authorizer for WebSocket APIs supports credential caching by TTL, and passing the authorization context via an integration request mapping template avoids re-invoking the authorizer on every request.
Question
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.)
Options
- AUse a token-based Lambda authorizer.
- BUse a request parameter-based Lambda authorizer.
- CConfigure an integration request mapping template to reference the context map from the
- DConfigure an integration request mapping template to reference the identity API key value from
- EUse VPC endpoint policies for the WebSocket APIs.
How the community answered
(52 responses)- A56% (29)
- B12% (6)
- D8% (4)
- E25% (13)
Why each option
A token-based Lambda authorizer for WebSocket APIs supports credential caching by TTL, and passing the authorization context via an integration request mapping template avoids re-invoking the authorizer on every request.
A token-based Lambda authorizer accepts a single token (such as a JWT or API key) and supports a configurable cache TTL, so the authorizer result is reused for subsequent requests with the same token rather than invoking the Lambda on every call.
A request parameter-based Lambda authorizer caches results based on a combination of multiple request parameters, which is more complex and less suited to simple token-based credential caching for WebSocket APIs.
Configuring an integration request mapping template to reference the context map from the Lambda authorizer allows downstream integrations to use the authorization data (such as user identity) that was already computed and cached, preventing redundant secret-key lookups.
Referencing the identity API key value from the method request in a mapping template exposes the raw API key downstream rather than the richer cached authorization context produced by the Lambda authorizer.
VPC endpoint policies control network-level access to API Gateway from within a VPC and have no effect on credential caching or token reuse at the application layer.
Concept tested: API Gateway token-based Lambda authorizer caching for WebSocket
Source: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-use-lambda-authorizer.html
Community Discussion
No community discussion yet for this question.