| title | rollback |
|---|---|
| description | Roll back your ECS service to a previous task definition revision. |
Two layers of deployment safety: your infrastructure rolls back bad deployments automatically, and you can manually return to any previous revision with one command.
- Your ECS service ships with a deployment circuit breaker — if a new deployment fails its health checks, AWS automatically rolls it back without you lifting a finger.
rollbacktakes you back to a previous task definition revision on demand: pass a revision number, or pick from an interactive list showing each revision's container image and registration date.- In automation and CI (or with
--headless), it defaults to the most recent older revision with no prompt. - Resolves its inputs automatically: cluster (
<project-name>-cluster, overridable viaECS_CLUSTER), service (<project-name>-service, overridable viaECS_SERVICE), and region (--region→AWS_REGION→terraform/main.tf→us-east-2).--workspacetargets a PR-preview environment's namespaced service. - Watches the rollback deployment until it stabilizes (up to 5 minutes), and points you to
statusandlogsif it fails or times out. - ECS only: on
--target lambdaprojects the command exits with the Lambda-native alternative — redeploy a previous image withaws lambda update-function-code(list SHA tags viaaws ecr describe-images). - Emits a
rollback_runtelemetry event recording success and outcome.
npx deploy-stack rollback
npx deploy-stack rollback 12
npx deploy-stack rollback --skip-wait
npx deploy-stack rollback 12 --cluster myapp-cluster --service myapp-serviceWithout a revision number, you'll see an interactive revision selector:
? Select a task definition revision to roll back to:
Revision 13 — myapp:sha-9f2c1ab (2026-09-20)
Revision 12 — myapp:sha-77d0e4f (2026-09-18)
Revision 11 — myapp:sha-51b8c2d (2026-09-15)
| Flag | Description |
|---|---|
[revision] |
Task revision to roll back to: a number (12), family:revision (myapp-task:12), or a full task definition ARN. Defaults to the most recent older revision (interactive prompt on a TTY). |
--cluster <name> |
Explicit cluster name override. |
--service <name> |
Explicit service name override. |
--region <region> |
Explicit AWS region override. |
--workspace <name> |
Roll back the PR-preview environment's service instead of production. |
--skip-wait |
Trigger the rollback and exit immediately without waiting for stabilization. |