Last active
July 24, 2017 09:38
-
-
Save chrisdpa-tvx/cb7ccf53be0756a52a104eb083969a84 to your computer and use it in GitHub Desktop.
Find Unhappy services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLUSTER=$1 | |
sts aws ecs list-services --cluster ${CLUSTER} |\ | |
jq -r '.[] | .[]' | xargs -J % -n10 sts \ | |
aws ecs describe-services --cluster ${CLUSTER} \ | |
--services % | jq -r '.services[] | select(.desiredCount!=.runningCount) | .serviceArn' > services | |
while read r;do | |
sts aws ecs update-service \ | |
--cluster ${CLUSTER} \ | |
--service ${r} \ | |
--desired-count=2 | |
done < services | |
sts aws ecs describe-clusters \ | |
--cluster ${CLUSTER} | jq -r ' .clusters[] | .pendingTasksCount' | |
while read r;do | |
sts aws ecs update-service \ | |
--cluster ${CLUSTER} \ | |
--service ${r} \ | |
--desired-count=3 | |
sleep 60 | |
done < services | |
# Describe a service with message history | |
sts aws ecs describe-services --cluster ${CLUSTER} --services ${SERVICE} | jq -r '.services[].events|=sort_by(.createdAt)' | |
# Describe services that are currently unstable | |
sts aws ecs list-services --cluster ${CLUSTER} |\ | |
jq -r '.[] | .[]' | xargs -J % -n10 sts \ | |
aws ecs describe-services --cluster ${CLUSTER} \ | |
--services % | jq -r '.services[] | select(.desiredCount!=.runningCount) | [.serviceArn, .desiredCount, .runningCount]' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment