···11+#!/bin/sh
22+33+date=$(date +%s)
44+for r in us-east-1 us-west-2; do
55+ for p in browse cgraph; do
66+ for e in test stage prod; do
77+ dir="/tmp/jws/${r}/${p}/${e}"
88+ mkdir -p "$dir"
99+ echo "Fetching ${r}/${p}/${e}"
1010+ aws ec2 describe-instances --profile "${p}_${e}" --region "$r" --output text --query "Reservations[*].Instances[*].{
1111+ Instance:InstanceId,
1212+ Type:InstanceType,
1313+ AZ:Placement.AvailabilityZone,
1414+ Name:Tags[?Key==\`Name\`]|[0].Value,
1515+ pubIP:PublicIpAddress,
1616+ IP:PrivateIpAddress,
1717+ State:State.Name
1818+ }" | sed "s/$/ ${p}_${e}/" > "$dir/$date" &
1919+ # add profile to end for easy greppin'
2020+ # link current for other scripts
2121+ ln -fs "$dir/$date" "$dir/current"
2222+ done
2323+ done
2424+done
2525+2626+wait
+9
bin/MACC02VK5ECHTD7/jws-grep
···11+#!/bin/sh
22+33+stuff=$(cat /tmp/jws/*/*/*/current)
44+55+for i in $@; do
66+ stuff=$(echo "$stuff" | grep -i $i)
77+done
88+99+echo "$stuff"
+25
bin/MACC02VK5ECHTD7/jws-ssh
···11+#!/bin/sh
22+# input: us-east-1a 172.29.71.236 i-0a7eb3896d61b4d22 Krakencld-app-ASG-A running m5.large None browse_test
33+# ssh's to hosts listed from jws-grep output
44+55+if ! [ -z "$1" ]; then
66+ echo "This script cannot be used interactively"
77+ exit 1
88+fi
99+1010+1111+tmux set default-shell "/bin/sh"
1212+# tmux new-window 'sleep 0.1'
1313+while IFS='$\n' read -r i; do
1414+ ip=$(echo "$i" | awk '{print $2}')
1515+ tmux split-window "ssh $ip"
1616+ tmux select-layout tiled
1717+done
1818+tmux set -u default-shell
1919+# tmux select-layout tiled
2020+# tmux setw synchronize-panes on
2121+2222+# todo?
2323+# if one result, directly ssh
2424+# if more than one result, do new window tmux madness
2525+