Skip to content

Instantly share code, notes, and snippets.

@eekfonky
Created April 13, 2018 07:51
Show Gist options
  • Save eekfonky/c9c99a3b43bc09aa54513d2d39c5968b to your computer and use it in GitHub Desktop.
Save eekfonky/c9c99a3b43bc09aa54513d2d39c5968b to your computer and use it in GitHub Desktop.
EC2 Task Status
#!/bin/bash
region="eu-west-1"
cluster="<CLUSTER_NAME>"
## Get Task names from Cluster
task_status () {
echo "Task Name and Status:"
mapfile -t tasksInCluster < <(aws ecs list-tasks --region $region --cluster $cluster | jq -r '.taskArns[]')
for task in "${tasksInCluster[@]}"; do
aws ecs describe-tasks --region $region --cluster $cluster --tasks $task | jq -r '.tasks[].containers[] | .name + " " + .lastStatus'
done
}
task_status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment