The problem
Swapping the broker behind a task queue sounds like a connection-string change until you ask the real question: what happens to the job that's mid-flight at the exact moment you cut over? Lose it, and work silently disappears β no error, no log, just a task that never runs. Duplicate it, and you've charged a card twice or sent a notification twice.
The pattern
A four-phase state machine for the cutover: parallel β cutover β draining β decommissioned .
Explicit rules for which transitions are allowed, including rollback, at every phase.
The old broker only gets decommissioned once two independent signals agree it's actually empty β not one check that could be wrong, not a timer, not an assumption.
Terraform provisions the replacement broker (ElastiCache/Valkey): replication group, subnet group, security group, parameter group.
Security findings that came from a real tool, not a self-assessment
This is the project where Checkov stopped being theoretical.β¦