Infra & Cloud
bash
Intermediate
New
ECS Task Force Stop
Force-stop all running ECS tasks in a service for emergency rollback.
bash
#!/bin/bash
CLUSTER=$1
SERVICE=$2
TASKS=$(aws ecs list-tasks --cluster $CLUSTER --service-name $SERVICE \
--query "taskArns[]" --output text)
for task in $TASKS; do
aws ecs stop-task --cluster $CLUSTER --task $task --reason "Emergency stop" > /dev/null
echo "Stopped: $task"
done
echo "All tasks stopped. ECS will restart from the current task definition."
Prerequisites
- aws-cli v2
- ECS permissions
Pro Tips
- → Pair with aws ecs update-service --desired-count 0 to prevent restart.
Commercial Licensing
Acquire a production access token or template license for enterprise deployment.
Module Info
- Language
- bash
- Level
- Intermediate
- Read time
- 3 min
- Published
- Sep 2026
- License
- Commercial License
Newsletter
New modules every week, directly to your inbox.
Similar Modules
AWS S3 Static Website
Terraform module to provision an S3 bucket for static website hosting.
terraform
·
Intermediate
AWS RDS Postgres Terraform
Terraform resource for an RDS PostgreSQL instance with encryption and backup.
terraform
·
Intermediate
AWS VPC with Public and Private Subnets
Terraform VPC module with NAT gateway, route tables and subnet tagging for EKS.
terraform
·
Advanced