DVA-C02 exam dumps

DVA-C02 practice question 243 of 399

AWS Certified Developer - Associate. Associate level, Amazon Web Services. Free question with the correct answer and a full explanation.

DVA-C02 Question 243

Single answer

A developer is building a serverless web application using AWS Lambda functions and Amazon API Gateway. The Lambda function is triggered via an HTTP request from the API Gateway. However, the developer notices that the Lambda function is not being invoked when an HTTP request is sent. Upon investigation, the developer suspects an issue with the permission configuration. What should the developer check to resolve the issue?

  1. A

    Ensure that the Lambda function has an AWS Identity and Access Management (IAM) execution role with sufficient permissions

  2. B

    Verify that the API Gateway's resource policy allows access to the Lambda function

  3. C

    Check if there is an explicit allow statement in the Lambda function's resource-based policy to permit API Gateway to invoke it

  4. D

    Make sure the API Gateway has been configured to use a VPC endpoint for invoking the Lambda function

Show answer and explanation

Correct answer: C

Explanation

To allow API Gateway to invoke a Lambda function, the Lambda function's resource-based policy must include an explicit permission granting API Gateway the 'lambda:InvokeFunction' action. This permission is critical for enabling the integration between API Gateway and Lambda. The other options either address unrelated configurations or are unnecessary for the described scenario.

  • A. Incorrect.

    This is incorrect. The Lambda function's execution role determines what AWS resources the function itself can access, not whether it can be invoked by API Gateway.

  • B. Incorrect.

    This is incorrect. API Gateway's resource policy controls access to the API Gateway, not the Lambda function it triggers.

  • C. Correct.

    This is correct. Lambda requires an explicit permission in its resource-based policy to allow API Gateway to invoke it. Without this permission, the invocation will fail.

  • D. Incorrect.

    This is incorrect. VPC endpoints are not required for API Gateway to invoke a Lambda function unless specific network configurations are in place, which is not mentioned in the scenario.

Timed practice exam

Take a DVA-C02 practice test under exam conditions

65 questions in 130 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam