Soru

Zorluk: OrtaAPI Development and Integration with Amazon API Gateway

An application developer is designing a new serverless microservice using Amazon API Gateway. The microservice must ingest JSON payloads from client applications, perform minimal transformations using Velocity Mapping Templates (VTL) directly in API Gateway to format the payloads for a downstream service, and authenticate users using standard JSON Web Tokens (JWT) generated by an Amazon Cognito User Pool. The developer wants to minimize latency, custom code overhead, and management complexity.

Which of the following actions should the developer perform to meet these requirements? (Select TWO.)

  1. Configure a Lambda custom integration for the integration request and define a Velocity Mapping Template (VTL) to transform the payload.Cevap
  2. Configure an Amazon Cognito user pool authorizer on the API Gateway method to validate the client JWTs.Cevap
  3. C
    Configure a Lambda proxy integration and define a Velocity Mapping Template (VTL) in the integration request to transform the payload.
  4. D
    Create a custom Lambda authorizer that imports the AWS SDK to validate and decode the Cognito JWT for each request.
  5. E
    Configure a Lambda proxy integration and use a method response mapping template to parse the incoming payload format.

Cevap

Configure a Lambda custom integration for the integration request and define a Velocity Mapping Template (VTL) to transform the payload, and configure an Amazon Cognito user pool authorizer on the API Gateway method to validate the client JWTs.
To transform payloads using Velocity Mapping Templates (VTL) before they reach the backend service, the developer must use a Lambda custom (non-proxy) integration because proxy integrations pass the raw event payload directly without allowing mapping templates. Additionally, to validate JWTs from Cognito with the lowest management overhead and custom code, the developer should configure the native Amazon Cognito user pool authorizer.

Adım Adım Çözüm

1
Determine the required integration type for payload transformation.
Since the scenario requires transforming the request payload directly in API Gateway using Velocity Mapping Templates (VTL) before passing it to the backend, a Lambda custom integration (non-proxy) must be selected.
Velocity Mapping Templates (VTL) are only supported in custom integrations (non-proxy integrations). Lambda proxy integration bypasses mapping templates completely.
2
Select the optimal authentication mechanism for Cognito JWT validation.
To validate standard JSON Web Tokens (JWT) generated by Amazon Cognito with minimal custom code and complexity, choose the native Amazon Cognito user pool authorizer.
Cognito user pool authorizers are built-in features that handle validation automatically, whereas custom Lambda authorizers require writing, deploying, and maintaining custom code.

Anahtar Kavram

API Gateway Integrations and Authorizers
Tahmini Süre:2m 0s
Bu soruyu puanla