Which solution will meet these requirements with the LEAST operational overhead?
Create a new version of the Lambda function. Create a new stage on API Gateway with integration to the new Lambda version. Use the new API Gateway stage to test the Lambda function.
Update the existing Lambda alias used by API Gateway to a weighted alias. Add the new Lambda version as an additional Lambda function with a weight of 10%. Use the existing API Gateway stage for testing.
Create a new version of the Lambda function. Create and deploy a second Lambda function to filter incoming requests from API Gateway. If the filtering Lambda function detects a test request, the filtering Lambda function will invoke the new Lambda version of the code. For other requests, the filtering Lambda function will invoke the old Lambda version. Update the API Gateway API to use the filtering Lambda function.
Create a new version of the Lambda function. Create a new API Gateway API for testing purposes. Update the integration of the new API with the new Lambda version. Use the new API for testing.
Explanations:
This option creates a new Lambda version and a new stage in API Gateway specifically for testing, which isolates the new function version from the production environment. It meets the requirement with minimal operational overhead.
A weighted alias would introduce some traffic (10%) from production to the new Lambda version, potentially impacting customers. This does not fully isolate the new code for testing and could lead to unintentional exposure to end users.
This option requires additional configuration and maintenance of a filtering Lambda function, increasing operational overhead. It also complicates the setup unnecessarily by adding conditional logic to route requests, which is less efficient.
Creating a new API Gateway API duplicates resources and complicates the setup, increasing operational overhead. Using a new API Gateway API for testing is unnecessary when a new stage can achieve the same isolation with less complexity.