A developer is building a serverless web API using Amazon API Gateway and AWS Lambda with a Lambda Proxy integration. Which two actions must the developer take to ensure the Lambda function correctly receives client requests and returns successful responses? (Select TWO.)
- Format the Lambda function's return object to contain the 'statusCode', 'headers', and 'body' properties.Answer
- Access incoming request details, such as query string parameters, directly from the 'event' input parameter of the Lambda handler.Answer
- CConfigure API Gateway integration response mapping templates to format the JSON response structure.
- DHardcode AWS IAM user credentials in the Lambda function code to authorize the integration between API Gateway and Lambda.
- EDeploy the Lambda function in a public VPC subnet with a public IP address to allow API Gateway to communicate with it.
Answer
The developer must format the Lambda function's return object to contain the 'statusCode', 'headers', and 'body' properties, and access incoming request details, such as query string parameters, directly from the 'event' input parameter of the Lambda handler.
For Lambda Proxy integrations, the Lambda function must return a response matching the expected JSON structure containing 'statusCode', 'headers', and 'body'. Additionally, all incoming request details (such as path parameters and query strings) are accessible via the 'event' parameter passed to the Lambda handler.
Step-by-Step Solution
Key Concept
API Gateway Lambda Proxy Integration requirements