| Strategy | Downtime | Rollback | Speed | Risk |
|---|---|---|---|---|
| All-at-once | Possible | Redeploy | Fastest | Highest |
| Rolling | No | Manual | Medium | Medium |
| Immutable | No | Terminate new | Slow | Low |
| Blue/Green | No | Switch back | Medium | Low |
| Canary | No | Automatic | Slow | Lowest |
| Type | Behavior |
|---|---|
| Canary10Percent5Minutes | 10% → 5min → 100% |
| Linear10PercentEvery1Minute | +10% every min |
| AllAtOnce | 100% immediately |
# Lambda
version: 0.0
Resources:
- MyFunction:
Type: AWS::Lambda::Function
Properties:
Name: my-function
Alias: live
CurrentVersion: 1
TargetVersion: 2
Hooks:
- BeforeAllowTraffic: PreTrafficHook
- AfterAllowTraffic: PostTrafficHook
| Platform | Hooks |
|---|---|
| EC2 | BeforeInstall → AfterInstall → ApplicationStart → ValidateService |
| Lambda | BeforeAllowTraffic → AfterAllowTraffic |
| ECS | BeforeInstall → AfterInstall → AfterAllowTestTraffic → BeforeAllowTraffic → AfterAllowTraffic |
Exam Tip: Canary = safest. AllAtOnce = fastest. appspec.yml format differs per platform. Hook order is a common exam question.