AWS Certified Developer – Associate (DVA-C02) — Question 275

A company is using Amazon API Gateway to invoke a new AWS Lambda function. The company has Lambda function versions in its PROD and DEV environments. In each environment, there is a Lambda function alias pointing to the corresponding Lambda function version. API Gateway has one stage that is configured to point at the PROD alias.

The company wants to configure API Gateway to enable the PROD and DEV Lambda function versions to be simultaneously and distinctly available.

Which solution will meet these requirements?

Answer options

Correct answer: D

Explanation

Using API Gateway stage variables allows you to dynamically define which Lambda function alias is invoked based on the stage processing the request (such as PROD or DEV). By creating a new stage for development and configuring stage variables in both the PROD and DEV stages to point to their respective Lambda aliases, you can route traffic to the correct environment concurrently. Other options are incorrect because Lambda authorizers, gateway responses, and "environment variables" (which do not exist in API Gateway) are not designed for routing requests to different Lambda function aliases.