Repository navigation
Roll ECS instances automatically when the AMI changes - #199
Conversation
Add a Rolling instance_refresh to the ECS Auto Scaling group. A new ECS-optimized AMI from SSM bumps the launch template version, and the refresh replaces instances one at a time. min 100 / max 150 makes AWS launch the replacement before it terminates the old instance. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🟢 All clear: Claude of Duty review passedMission: Review the code. Protect the branch. Deploy the future. Tip No findings. This review found no reason to block. Nothing to do for this review.
Run 45219166947, attempt 1 for head Claude of Duty never approves a PR. A human reviewer gives the final approval. 📋 Full review record: reasons, checks, signals, finding details, model summaries, token usageReviewed snapshot
Reasons the gate failed None. No reason applies. Checks (code, no model)
Signals (context only, never block) None. Dependency changes None. Finding details
Blocking is decided by code from category and severity, never by the model. A finding in a blocking category blocks only at high or critical severity. No findings. All three passes completed. Model summaries
Token usage
|
Summary
When the ECS-optimized AMI in SSM changes,
terraform applyonly made a new launch template version. Running instances kept the old AMI. This PR adds a Rollinginstance_refreshto the ECS Auto Scaling group, so AWS replaces the instances on each apply that changes the AMI.min_healthy_percentage = 100,max_healthy_percentage = 150: AWS launches the replacement before it terminates the old instance. Peak is 3 instances (max_size is 4).skip_matching = true: instances already on the new launch template are not replaced.Pending AMI change in this apply
ami-0e5deb4438b0e4cdc(al2023 ECS 20261031) ->ami-0b1a5dd0c892f59c8(al2023 ECS 20261119): ECS agent 1.108.2 -> 1.108.3, AL2023 base package updates. Docker, containerd, runc unchanged.Verification
terraform fmt -check,terraform validate: pass.terraform plan: 0 add, 2 change (ASG getsinstance_refresh, launch template gets the new AMI), 0 destroy.Known risk
No ECS drain step: tasks on a terminated instance stop suddenly and ECS restarts them on the remaining instances. The replacement instance is already in service, so the disruption is short but not zero.
🤖 Generated with Claude Code