Soru

Zorluk: KolayAPI Development and Integration with Amazon API Gateway

A software engineer is building a REST API using Amazon API Gateway. They set up the API to route incoming client requests directly to an AWS Lambda function using the proxy integration type. Which two statements correctly describe how data is exchanged between API Gateway and the backend function in this configuration? (Select TWO.)

  1. API Gateway passes the raw HTTP request details, including headers and query string parameters, directly to the Lambda function inside the event object.Cevap
  2. B
    API Gateway requires the developer to define Integration Request velocity templates to map query parameters into JSON before invoking the function.
  3. The Lambda function must return its output in a specific JSON format containing fields such as statusCode, headers, and body.Cevap
  4. D
    API Gateway automatically wraps any custom string or raw object returned by the Lambda function in an HTTP 200 OK response.
  5. E
    API Gateway requires a custom Lambda authorizer to authenticate requests when utilizing a Lambda proxy integration.

Cevap

In a Lambda proxy integration, API Gateway passes the raw HTTP request directly to the Lambda function inside the event object, and the Lambda function must return its response in a structured JSON payload containing the statusCode, headers, and body fields.
In a Lambda proxy integration, API Gateway passes the raw HTTP request (headers, query parameters, path variables, and body) directly to the backend function as a JSON event. Additionally, the backend function must return its response in a specific JSON structure with statusCode, headers, and body fields so that API Gateway can correctly format the HTTP response to the client.

Adım Adım Çözüm

1
Analyze how request parameters and payloads are forwarded from API Gateway to Lambda in a proxy integration.
Confirm that the proxy integration passes the incoming request directly as the JSON event object to the function, without requiring integration mapping templates.
To identify that raw request details are directly available in the event parameter of the handler function.
2
Examine the output format required by the Lambda function for API Gateway to correctly construct the HTTP response.
Determine that the function must return a JSON payload with specific fields: statusCode, headers, and body.
To ensure API Gateway can map the function's output to a valid HTTP response instead of failing with a 502 Bad Gateway error.

Anahtar Kavram

The behavior and payload requirements of Amazon API Gateway Lambda Proxy Integration.
Bu soruyu puanla