Skip to content

ck ecs

Commands for Amazon ECS in the active AWS profile and region. Log in first with ck aws login.

Command What it does
clusters List clusters
services List services in a cluster
tasks List tasks in a cluster
service-tasks List tasks of one service
task-info Show details of a task
exec Run a command in a container
exec-running Run a command in the first running task
logs Show a task’s container name
stop Stop a task
describe Describe a service
ck ecs clusters

List all clusters.

ck ecs services <cluster>

List the services in a cluster.

Terminal window
ck ecs services my-cluster
ck ecs tasks <cluster> [--running]

List tasks in a cluster with their ID, last and desired status, container and uptime. Add --running to show only tasks whose desired status is RUNNING.

Terminal window
ck ecs tasks my-cluster --running
ck ecs service-tasks <cluster> <service> [--running]

Same as tasks, limited to one service.

Terminal window
ck ecs service-tasks my-cluster api --running
ck ecs task-info <cluster> <task-id>

Show a task’s status, first container, image, uptime and creation time.

Terminal window
ck ecs task-info my-cluster abc123def456
ck ecs exec <cluster> <task-id> <container> [command]

Run a command in a container through ECS Exec. Without a command, it opens /bin/bash.

Terminal window
ck ecs exec my-cluster abc123def456 app
ck ecs exec my-cluster abc123def456 app "php artisan migrate:status"
ck ecs exec-running <cluster> <container> [--service <service>] [command]

Like exec, but picks the first running task for you. Add --service to pick from one service only. Without a command, it opens /bin/bash.

Terminal window
ck ecs exec-running my-cluster app
ck ecs exec-running my-cluster app --service api ls -la /var/log
ck ecs logs <cluster> <task-id> [--tail N]

Show the task ID and its first container’s name.

ck ecs stop <cluster> <task-id> [reason]

Stop a task. The reason defaults to Stopped via CLI.

Terminal window
ck ecs stop my-cluster abc123def456 "stuck task"
ck ecs describe <cluster> <service>

Show a service’s name, status, running and desired task counts, and task definition.

Terminal window
ck ecs describe my-cluster api