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
Section titled “ck ecs clusters”ck ecs clustersList all clusters.
ck ecs services
Section titled “ck ecs services”ck ecs services <cluster>List the services in a cluster.
ck ecs services my-clusterck ecs tasks
Section titled “ck ecs tasks”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.
ck ecs tasks my-cluster --runningck ecs service-tasks
Section titled “ck ecs service-tasks”ck ecs service-tasks <cluster> <service> [--running]Same as tasks, limited to one service.
ck ecs service-tasks my-cluster api --runningck ecs task-info
Section titled “ck ecs task-info”ck ecs task-info <cluster> <task-id>Show a task’s status, first container, image, uptime and creation time.
ck ecs task-info my-cluster abc123def456ck ecs exec
Section titled “ck ecs exec”ck ecs exec <cluster> <task-id> <container> [command]Run a command in a container through ECS Exec. Without a command, it opens /bin/bash.
ck ecs exec my-cluster abc123def456 appck ecs exec my-cluster abc123def456 app "php artisan migrate:status"ck ecs exec-running
Section titled “ck ecs exec-running”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.
ck ecs exec-running my-cluster appck ecs exec-running my-cluster app --service api ls -la /var/logck ecs logs
Section titled “ck ecs logs”ck ecs logs <cluster> <task-id> [--tail N]Show the task ID and its first container’s name.
ck ecs stop
Section titled “ck ecs stop”ck ecs stop <cluster> <task-id> [reason]Stop a task. The reason defaults to Stopped via CLI.
ck ecs stop my-cluster abc123def456 "stuck task"ck ecs describe
Section titled “ck ecs describe”ck ecs describe <cluster> <service>Show a service’s name, status, running and desired task counts, and task definition.
ck ecs describe my-cluster api