Created
September 15, 2018 02:52
-
-
Save skyzyx/75c686d29e9749ccc06033f2b571b282 to your computer and use it in GitHub Desktop.
Check the launch status of the underlying EC2 instances in an ECS cluster.
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
## | |
# Requires: | |
# * AWS Unified CLI Tools | |
# * jq | |
## | |
cluster_name="name-of-ecs-cluster" | |
aws ec2 describe-instance-status \ | |
--instance-ids $( | |
aws ecs describe-container-instances \ | |
--cluster $cluster_name \ | |
--container-instances $( | |
aws ecs list-container-instances \ | |
--cluster $cluster_name \ | |
| jq -r ".containerInstanceArns[]" | |
) \ | |
| jq -r ".containerInstances[].ec2InstanceId" | |
) \ | |
| jq -r '.InstanceStatuses[] | { | |
"id": .InstanceId, | |
"state": .InstanceState.Name, | |
"statusCheck1": .InstanceStatus.Status, | |
"statusCheck2": .SystemStatus.Status | |
}' \ | |
; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment