DVA-C02 · Question #763
DVA-C02 Question #763: Real Exam Question with Answer & Explanation
The correct answer is D: Configure a resource-based policy on the Lambda function to grant the REST API permissions to. When API Gateway invokes a Lambda function, Lambda must explicitly allow that invocation. This is done by adding a resource-based permission on the Lambda function that grants the API Gateway service (with the specific API/stage/method/resource ARN) the lambda:InvokeFunction perm
Question
A developer is configuring an Amazon API Gateway REST API. The REST API contains a resource that implements a GET method. The GET method uses an integration request that has an integration type of Lambda function to invoke an AWS Lambda function. The developer configures the API to have multiple environment stages and stage variables. During testing, the developer makes a single GET request to the API resource and received an 500 Internal Server Error. The developer must resolve the error. Which solution will meet this requirement?
Options
- AConfigure the Lambda function to use a Lambda layer for the REST API.
- BConfigure reserved concurrency for the Lambda function.
- CDeploy the REST API and the Lambda function in the same Availability Zone.
- DConfigure a resource-based policy on the Lambda function to grant the REST API permissions to
Explanation
When API Gateway invokes a Lambda function, Lambda must explicitly allow that invocation. This is done by adding a resource-based permission on the Lambda function that grants the API Gateway service (with the specific API/stage/method/resource ARN) the lambda:InvokeFunction permission. Missing or incorrect invoke permissions commonly results in API Gateway returning a 500 Internal Server Error for a Lambda integration.
Community Discussion
No community discussion yet for this question.