DVA-C02 exam dumps

DVA-C02 practice question 251 of 399

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

DVA-C02 Question 251

Single answer

You are developing a serverless application using AWS Lambda and API Gateway. To validate the integration between your Lambda function and external APIs during testing, you decide to use mock endpoints. Which of the following approaches would best suit this scenario?

  1. A

    Configure an API Gateway stage with mock integration responses.

  2. B

    Use AWS X-Ray to simulate API responses for testing.

  3. C

    Write a Lambda function that mocks the external API and deploy it as a separate endpoint.

  4. D

    Set up an Amazon S3 bucket to serve as a mock endpoint for the external API.

Show answer and explanation

Correct answer: A

Explanation

When testing integrations between AWS Lambda and external APIs, API Gateway's built-in mock integration feature is the most efficient solution. It allows you to define and test predictable responses without relying on the actual external API. This ensures your integration tests are consistent and independent of external factors like downtime or rate limits.

  • A. Correct.

    Correct: API Gateway stages with mock integration responses allow you to simulate responses without invoking the actual backend. This is an efficient way to test integration without external dependencies.

  • B. Incorrect.

    Incorrect: AWS X-Ray is primarily used for tracing and debugging application performance, not for simulating or mocking API responses.

  • C. Incorrect.

    Incorrect: Writing and deploying a separate Lambda function to mock the API is unnecessary overhead when API Gateway already provides a built-in mechanism for mocking responses.

  • D. Incorrect.

    Incorrect: S3 is designed for object storage and not as a suitable mechanism to simulate API responses, especially for integration testing scenarios.

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