ecstop is a CLI tool to instantly stop your running resources of Amazon ECS to save costs.
This tool focuses on stopping ECS Services, Tasks, and Container Instances because they cost higher. On the other hand, it does NOT clean Task Definitions or ECR Images, which are free or cheaper.
Pronounce: ee-c-stop
$ brew install t-kikuc/tap/ecstop
You can enable the autocompletion by ecstop completion
.
Example:
$ source <(ecstop completion zsh)
For details, run:
$ ecstop completion --help
services
: Scale-in Servicestasks
: Stop Tasksinstances
: Stop Container Instancesall
: Stop the above 3 resources
You can execute the above commands with the following options:
-p, --profile string AWS profile (optional)
-r, --region string AWS region (optional)
-a, --all-clusters Stop resources in all clusters in the region
-c, --cluster string Name or ARN of the cluster to stop resources
Only one of --all-clusters
or --cluster
is required.
It updates desiredCount
of ECS services to 0.
It stops ECS tasks.
This command is mainly used for standalone tasks, which are not controlled by ECS Services. Even if you stop tasks of an ECS Service, the Service will start new tasks.
Flags:
--group string Group name to stop tasks
--group-prefix string Group name prefix to stop tasks
--standalone Stop standalone tasks, whose group prefix is not 'service:'
Only one of --group
, --group-prefix
, or --standalone
is required.
- ecstop stops all tasks whose
group
matches the condition. --standalone
stops tasks whosegroup
's prefix is NOTservice:
.
It stops container instances. (not terminate)
It stops services, standalone tasks, and container instances.
For example, ecstop all --cluster xxx
is equal to:
ecstop services --cluster xxx
ecstop tasks --cluster xxx --standalone
ecstop instances --cluster xxx
ecs:
- Read
ListClusters
ListServices
ListTasks
ListContainerInstances
DescribeServices
DescribeTasks
- Write
UpdateService
StopTask
DescribeContainerInstances
ec2:
- Write
StopInstances