Created
May 5, 2017 19:47
-
-
Save cpuspellcaster/7d00698301c8f47e5d14d03c1216bf0a to your computer and use it in GitHub Desktop.
Query all ECS instances and get output of 'docker ps'
This file contains hidden or 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
| #! /usr/bin/env bash | |
| IP_ADDRS=$( | |
| aws --profile prod ec2 describe-instances \ | |
| --filters \ | |
| "Name=tag:Environment,Values=prod" \ | |
| "Name=tag:Name,Values=blackbird_microservices" \ | |
| "Name=instance-state-name,Values=running" \ | |
| --query "Reservations[*].Instances[*].PrivateIpAddress" \ | |
| --output text | |
| ) | |
| for IP_ADDR in $IP_ADDRS; do | |
| echo " === $IP_ADDR ===" | |
| ssh ec2-user@$IP_ADDR docker ps | |
| echo "" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment