Skip to content

Instantly share code, notes, and snippets.

@ianchesal
Created June 30, 2021 19:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ianchesal/5afbceae4ebbc1a1fffd51394260e613 to your computer and use it in GitHub Desktop.
Save ianchesal/5afbceae4ebbc1a1fffd51394260e613 to your computer and use it in GitHub Desktop.
List fargate content in ECS clusters
#!/bin/bash
# Returns the count of Fargate content in each ECS cluster in your account+region.
aws ecs list-clusters 2>/dev/null | jq -c '.clusterArns[]' | while read cluster; do
cluster="${cluster%\"}"
cluster="${cluster#\"}"
cname=$(basename $cluster)
echo "Checking: $cname"
aws ecs list-services --cluster $cname --launch-type FARGATE 2>/dev/null | jq '.serviceArns | length'
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment