How to Test Updated Lambda Functions with a Subset of Users Using API Gateway?
Short answer
A Create a new version of each Lambda function with a weighted alias. Configure a weight value for each version of the Lambda function. Update the new weighted alias Amazon Resource Name (ARN) in the REST API.
Question
Key Takeaways
The question evaluates understanding of Lambda versioning and weighted aliases for traffic shifting, highlighting the trap of over-engineering with new APIs or CodeDeploy when a simple alias update suffices.
This question tests the most efficient way to perform canary testing of updated AWS Lambda functions behind an Amazon API Gateway REST API using weighted aliases, minimizing operational overhead while isolating a subset of users.
Common mistake: Many candidates choose Option B, assuming API Gateway canary settings require less effort, but creating a new REST API and configuring proxy integrations for multiple Lambda functions adds unnecessary complexity and operational overhead.
Expert Analysis
Understanding the Requirement
The scenario requires testing updated Lambda functions with a subset of users before full deployment, ensuring no impact on other users, and achieving this with the LEAST operational effort. This is a classic canary deployment or traffic shifting use case.
Why Option A is Correct
Option A leverages Lambda weighted aliases, a native feature designed precisely for this purpose:
- Create a new version of the Lambda function.
- Assign a weighted alias pointing to both the old and new versions with specified traffic percentages (e.g., 90% to old, 10% to new).
- Update the API Gateway integration to use the alias ARN instead of the function name or version ARN.
This approach is simple, direct, and requires minimal configuration changes. It allows precise control over traffic distribution without duplicating infrastructure or introducing additional services.
Why Other Options Are Incorrect
- Option B: Suggests creating a new REST API and using canary settings on the deployment stage. While API Gateway does support canary deployments, creating an entirely new API introduces significant operational overhead—duplicating resources, managing separate endpoints, and coordinating deployments. This contradicts the "LEAST operational effort" requirement.
- Option C: Proposes using AWS CodeDeploy for automated canary deployments. While CodeDeploy is powerful for EC2 or ECS deployments, using it for Lambda functions behind API Gateway adds unnecessary complexity. CodeDeploy is better suited for infrastructure-level deployments, not API traffic shifting.
- Option D: Similar to Option B but with non-proxy integration, which requires manual mapping of request/response parameters. This is even more complex than proxy integration and definitely not the least-effort solution.
Community Consensus
The community is split (50% A, 48% B), with many candidates initially attracted to Option B due to the phrase "LEAST operational effort." However, as noted by multiple commenters, creating a new REST API (Options B and D) inherently involves more work than simply updating an alias ARN in the existing API configuration. Option A is the most straightforward and aligns with AWS best practices for Lambda traffic shifting.
Official Reference
- https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html
- https://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html
These links open the official vendor documentation in a new tab.
Exam Strategy
When a question emphasizes 'LEAST operational effort,' avoid solutions that require creating new infrastructure (e.g., new APIs, new services). Look for native, lightweight features like weighted aliases that achieve the goal with minimal configuration changes.
Community Votes
51% of anonymous learners picked answer A. Votes are pick records left by other test-takers — they are not the verified answer.
Discussion 19 contributions
Compiled from public community threads and reader submissions, lightly edited for clarity. Handles and vote tallies are shown as recorded, and comments reflect the views of individual contributors.
From public community threads 19
-
DeaconStJohn 👍 9 Answered AThe wording is screaming out weighted alias. During a canary deployment, we are moving code from testing to prod. We can define a subset of users i.e. 10% for a set period of time. After this the other users will be impacted as the percentage will increment or the deployment will push new code to 100% of users. With a weighted alias we can define a subset of users and use this as our guinea pigs to test new code. As this isn't a canary deployment we have no risk of more users becoming impacted. Operational overhead is minimal as we only need to point to a new alias. With weighted alias we can deploy for testing purposes. From my understanding lambda proxy is grouping lambda functions. the traffic splitting would need to be set at the lambda level as this is testing prior to deployment.
-
ethanluvsbooks 👍 5 Answered BThis is the least amount of effort. I originally thought answer A but then you will have more effort because will have to update API Gateway configuration to use new ARN etc. Unless there are other thoughts on this?
-
CrescentShared 👍 5 Answered BOption A involves using weighted aliases for Lambda functions, which is a valid approach but requires more effort to manage and update the aliases in the API Gateway configuration.
-
yingying920928 👍 4 Answered APrefer A, because creating a new REST API (B) involves more operational overhead and complexity compared to using weighted aliases. Moreover, setting up a Lambda proxy integration to connect to multiple Lambda functions can increase complexity, especially when handling different versions for canary testing.
-
tgv 👍 4 Answered ALambda with weighted alias with weight configured for each version of the function. The canary situation is much suitable for deployments.
Show 14 more comments
-
KarBiswa 👍 3 Answered Bhttps://docs.aws.amazon.com/apigateway/latest/developerguide/set-up-lambda-proxy-integrations.html
-
a1971h 👍 3 Answered BIt says: with the LEAST amount of operational effort B --- NEVER A!!!
-
wh1t4k3r 👍 2I am going with A, not sure if creating a new rest api is less effort then just managing the existing API config for the weight.
-
ANDRES715 👍 1 Answered D} El desarrollador debe crear una nueva API REST en Amazon API Gateway y configurar una integración Lambda sin proxy para conectarse a múltiples funciones Lambda. Luego, debe especificar los parámetros y propiedades necesarios en API Gateway y habilitar la configuración canary en la etapa de implementación. Especifique un porcentaje menor de tráfico API para ir a la nueva versión de la función Lambda. Al utilizar una nueva API REST en API Gateway con una configuración canary, el desarrollador puede probar las funciones Lambda actualizadas con nuevas características con un subconjunto de usuarios antes de la implementación completa. Esto permite realizar pruebas sin afectar a otros usuarios de la aplicación y con un menor esfuerzo operativo.
-
examuserss 👍 1 Answered ABest Solution: Option A: Create a new version of each Lambda function with a weighted alias. Configure a weight value for each version of the Lambda function. Update the new weighted alias Amazon Resource Name (ARN) in the REST API. This is the least complex and most efficient solution. By using weighted aliases for Lambda versions, you can control the traffic sent to the new version of the function, and it can be done with minimal operational overhead, without the need to create a new API or involve other services like AWS CodeDeploy.
-
tomchandler077 👍 1Option A is typically the most straightforward and requires the least operational effort while providing high control over traffic distribution directly from the Lambda configuration. This method avoids the overhead of managing additional services or creating new APIs and is directly supported by AWS services for testing purposes with actual users.
-
Shamalka 👍 1 Answered AThe simple answer is A. The Simple reason for the answer to not be D is why you would need to create a new Rest API endpoint.?
-
ShakthiGCP 👍 1 Answered AYes. Answer is Option A. B will eventually push all users to new alias as part of canary deployment.
-
Saudis 👍 1 Answered BB provides the least operational effort
-
monishvster 👍 5 Answered BShould be B
-
Americo32 👍 2Opção A
-
65703c1 👍 1 Answered AA is the correct answer.
-
abdulla203 👍 1 Answered AI think A is direct
-
ShakthiGCP 👍 1 Answered AWeight ed alias
Reader comments & corrections
No reader corrections yet — spotted an error or have a note? Share it below.
Related Analysis
Practice All DVA-C02 Questions
Access 100 questions with complete answers and detailed explanations.
View Full DVA-C02 Practice Test →