DVA-C02 exam dumps

DVA-C02 practice question 252 of 399

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

DVA-C02 Question 252

Single answer

You are developing a serverless application using AWS Lambda and API Gateway. To perform integration testing in your CI/CD pipeline, you decide to mock the endpoints of external APIs to avoid hitting production services. Which of the following approaches would be most suitable for implementing this in AWS?

  1. A

    Use AWS Step Functions to replace the API calls with mock states for testing purposes.

  2. B

    Deploy a local instance of the external APIs and update your Lambda environment variables to point to the local instance during testing.

  3. C

    Use API Gateway’s Mock Integration feature to configure mock responses for the API endpoints.

  4. D

    Create an Amazon API Gateway stage specifically for testing, and configure it to route requests to an internal mock service.

Show answer and explanation

Correct answer: C

Explanation

The API Gateway Mock Integration feature is a built-in capability that allows you to define static mock responses for endpoints without relying on external services. This makes it an ideal solution for quickly setting up mock endpoints for integration testing in your CI/CD pipeline without hitting production APIs.

  • A. Incorrect.

    AWS Step Functions are used to orchestrate workflows and can include mock states, but they are not designed to serve as mock endpoints for API Gateway or Lambda integration testing.

  • B. Incorrect.

    Deploying a local instance of external APIs can be complex, time-consuming, and not scalable for CI/CD pipelines. This solution is not ideal for mocking external endpoints.

  • C. Correct.

    API Gateway’s Mock Integration feature allows you to define mock responses directly in the API Gateway configuration. This is a lightweight and effective solution for mocking endpoints in integration testing.

  • D. Incorrect.

    While creating a separate API Gateway stage for testing is a valid approach, it does not inherently provide a mechanism to mock external API responses. You would still need to implement the mock service separately.

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