AWS Certified Developer – Associate (DVA-C02)DeploymentEasy
A developer is building a serverless application using AWS Lambda and Amazon API Gateway. They need to ensure that different versions of their Lambda function can be invoked through the same API Gateway endpoint, allowing for controlled traffic shifting between versions. Which Lambda feature, when combined with API Gateway stages, enables this functionality?
- ALambda aliases
- BLambda environment variables
- CLambda layers
- DLambda provisioned concurrency
Show answer & explanationAnswer & explanation
Correct answer: A. Lambda aliases
Lambda aliases are pointers to specific Lambda function versions. When integrated with API Gateway stages, aliases allow you to map an API Gateway stage (e.g., 'prod' or 'beta') to a specific Lambda alias, which in turn can be configured to split traffic between two Lambda function versions, enabling canary deployments or A/B testing.
Why the other options are wrong
- B. Environment variables are for configuration within a function, not for managing different versions or traffic shifting.
- C. Layers are for sharing code and dependencies between functions, not for versioning or traffic routing.
- D. Provisioned concurrency pre-initializes execution environments to reduce cold starts, it's unrelated to versioning or traffic shifting.
Lambda Aliases & API Gateway Stages
Lambda aliases point to specific Lambda function versions, and when integrated with API Gateway stages, they enable controlled traffic shifting and phased deployments by mapping stages to aliases.
- Alias points to a version.
- API Gateway stage maps to an alias.
- Enables traffic shifting between versions.
Memory trick: ALIAS-STAGE: Always Lead In A Smooth Traffic Gate.