AWS Certified Developer – Associate (DVA-C02)DeploymentMedium
A developer is building a serverless application using AWS Lambda and Amazon API Gateway. They need to implement a blue/green deployment strategy for their Lambda function to minimize downtime and provide an easy rollback mechanism. How can this be achieved using existing AWS services?
- AImplement a custom script to replicate the Lambda function, test it, and then update DNS records to point to the new version.
- BManually create two separate Lambda functions (blue and green) and update the API Gateway integration to switch between them.
- CUse an AWS CodeDeploy blue/green deployment group targeting the Lambda function directly.
- DUtilize Lambda aliases and API Gateway stages, configuring CodeDeploy to shift traffic between alias versions.
Show answer & explanationAnswer & explanation
Correct answer: D. Utilize Lambda aliases and API Gateway stages, configuring CodeDeploy to shift traffic between alias versions.
Lambda aliases combined with API Gateway stages provide a robust blue/green deployment strategy for serverless applications. CodeDeploy can automate the traffic shifting between different versions associated with the Lambda alias, ensuring a controlled and gradual rollout with easy rollback capability.
Why the other options are wrong
- A. Updating DNS for Lambda functions is not a standard or efficient blue/green strategy, and managing custom scripts adds complexity.
- B. Manual switching is error-prone, lacks automation, and doesn't provide gradual traffic shifting or easy rollback.
- C. CodeDeploy for Lambda doesn't use 'deployment groups' in the same way as EC2; it works with aliases.
Lambda Aliases & API Gateway Stages for Blue/Green
A deployment pattern for serverless applications where Lambda aliases manage different function versions, and API Gateway stages point to these aliases, enabling controlled traffic shifting for blue/green deployments.
- Lambda aliases provide stable endpoints for specific function versions.
- API Gateway stages link to Lambda aliases for environment management.
- CodeDeploy can automate traffic shifting between alias versions for blue/green deployments.
Memory trick: Aliases are the versions, Stages are the gates, CodeDeploy shifts the flow.