Linear Deployment Strategy - AWS Developer Associate Guide
What is Linear Deployment Strategy?
A Linear deployment strategy is a traffic-shifting approach used in AWS CodeDeploy and AWS Lambda that gradually shifts traffic to a new version of your application in equal increments over a specified period of time. Unlike all-at-once deployments, linear deployments provide a controlled, predictable rollout pattern.
Why is Linear Deployment Important?
Linear deployment is crucial for several reasons:
• Risk Mitigation: By shifting traffic gradually, you can detect issues early before they affect all users
• Controlled Rollout: Provides predictable, time-based traffic shifting that is easy to monitor
• Reduced Blast Radius: If problems occur, only a portion of traffic is affected
• Easy Rollback: Issues can be detected during incremental shifts, allowing for automatic or manual rollback
• Compliance Requirements: Some organizations require gradual deployments for regulatory purposes
How Linear Deployment Works
Linear deployment shifts traffic in equal portions at regular intervals:
1. Initial State: 100% of traffic goes to the original version
2. First Increment: A fixed percentage shifts to the new version
3. Subsequent Increments: Equal percentages shift at each interval
4. Completion: 100% of traffic reaches the new version
AWS Linear Deployment Configurations:
For Lambda:
• Linear10PercentEvery10Minutes - Shifts 10% every 10 minutes
• Linear10PercentEvery1Minute - Shifts 10% every 1 minute
• Linear10PercentEvery2Minutes - Shifts 10% every 2 minutes
• Linear10PercentEvery3Minutes - Shifts 10% every 3 minutes
For ECS:
• Linear10PercentEvery1Minutes
• Linear10PercentEvery3Minutes
Linear vs Canary Deployment
Understanding the difference is essential for exam success:
• Linear: Equal increments at regular intervals (e.g., 10% every 10 minutes)
• Canary: Two-step process - small percentage first, then remainder (e.g., 10% initially, then 90% after validation)
Implementation with AWS SAM
In your SAM template, specify the deployment preference:
DeploymentPreference:
Type: Linear10PercentEvery10Minutes
Alarms: [list of CloudWatch alarms]
Hooks: PreTraffic and PostTraffic Lambda functions
Exam Tips: Answering Questions on Linear Deployment Strategy
1. Recognize Keywords: Look for phrases like "equal increments," "gradual shift," "regular intervals," or "predictable rollout" - these indicate linear deployment
2. Know the Naming Convention: AWS linear configurations follow the pattern LinearXPercentEveryYMinutes - memorize common values
3. Differentiate from Canary: If the question mentions a small initial test followed by full deployment, that is Canary, not Linear. Linear uses consistent, equal increments throughout
4. Time Calculations: Be prepared to calculate total deployment time. For Linear10PercentEvery10Minutes, full deployment takes approximately 100 minutes (10 intervals)
5. Service Context: Remember that linear deployment is available for Lambda and ECS through CodeDeploy, not for EC2 in-place deployments
6. Rollback Triggers: Know that CloudWatch alarms can trigger automatic rollbacks during linear deployments
7. Hooks Understanding: PreTraffic and PostTraffic hooks can run validation tests during linear deployments
8. Use Case Matching: When a scenario requires steady, predictable traffic shifting over time with consistent monitoring windows, linear deployment is the answer
9. Blue/Green Relationship: Linear deployment is a type of blue/green deployment strategy - it uses alias shifting between Lambda versions
10. SAM Integration: Questions about serverless deployments with gradual rollout typically involve AWS SAM DeploymentPreference settings