Soru

Zorluk: KolayAPI Development and Integration with Amazon API Gateway

A company is deploying a REST API using Amazon API Gateway. The API routes client requests to a backend AWS Lambda function. The function needs to read the incoming HTTP request headers and query parameters, and it must also specify the response status code and response headers directly within its execution code. What configuration should the company choose to ensure that the raw request is passed intact to the function, and that the function's output determines the client's HTTP response?

  1. Enable the proxy integration option for the Lambda function backend.Cevap
  2. B
    Configure a non-proxy integration and define Velocity Template Language (VTL) mapping templates.
  3. C
    Set up a custom Lambda authorizer that maps the response headers and status codes.
  4. D
    Deploy an HTTP integration that forwards the request to an Application Load Balancer.

Cevap

Enable the proxy integration option for the Lambda function backend.
The option to enable the proxy integration option for the Lambda function backend is correct because proxy integration automatically maps the raw client request into an event object for Lambda, and directly interprets Lambda's JSON output (which includes statusCode, headers, and body) to construct the HTTP response.

Adım Adım Çözüm

1
Identify the application requirements.
The Lambda function needs to receive all headers and query parameters, and dynamically control the response status code and headers.
This determines whether a custom mapping (non-proxy) or a transparent pass-through (proxy) integration is needed.
2
Compare integration types in Amazon API Gateway.
Proxy integration passes the client request as a standardized event object to the Lambda function and parses a structured JSON output from the Lambda function to formulate the HTTP response.
This avoids having to define Velocity Template Language (VTL) mapping templates inside API Gateway.
3
Select the correct configuration.
Choose the option to enable the proxy integration for the Lambda backend.
This satisfies all requirements with minimal administrative overhead.

Anahtar Kavram

API Gateway Proxy Integration vs. Custom/Non-Proxy Integration

Alternatif Yöntem

Instead of using the AWS Management Console, the proxy integration can be configured programmatically using an AWS SAM or CloudFormation template by setting the integration Type to 'AWS_PROXY'.
Tahmini Süre:45s
Bu soruyu puanla