Last active
July 28, 2017 14:02
-
-
Save chrisdpa-tvx/b72828368eee8a94ba874ede075d0d5e to your computer and use it in GitHub Desktop.
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
set -exu | |
SPOTFLEETREQ=$1 | |
CLUSTER=$2 | |
AZ=$3 | |
fleet_sz=$(aws ec2 describe-spot-fleet-instances --spot-fleet-request-id ${SPOTFLEETREQ} | jq -r '.ActiveInstances|length') | |
container_sz=$(aws ecs list-container-instances --cluster ${CLUSTER} | jq -r '.containerInstanceArns[]' | \ | |
xargs -n10 -J % aws ecs describe-container-instances --cluster ${CLUSTER} --container-instances % | \ | |
jq -r ".containerInstances[].attributes[]|select(.name==\"ecs.availability-zone\" and .value==\"${AZ}\")|.value"|wc -l | xargs) | |
if (( fleet_sz == container_sz )); then | |
exit 0 | |
fi; | |
exit 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment