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?
- Enable the proxy integration option for the Lambda function backend.Cevap
- BConfigure a non-proxy integration and define Velocity Template Language (VTL) mapping templates.
- CSet up a custom Lambda authorizer that maps the response headers and status codes.
- DDeploy 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
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