Skip to content

Instantly share code, notes, and snippets.

@ekesken
Last active April 8, 2020 13:42
Show Gist options
  • Save ekesken/a1045085dcd8df659930010d2ed37abb to your computer and use it in GitHub Desktop.
Save ekesken/a1045085dcd8df659930010d2ed37abb to your computer and use it in GitHub Desktop.
#!/bin/bash
set -eo pipefail
cat /tmp/copy-pasted-text-from-browser.txt \
| grep host | awk -F: '{print $2}' \
| xargs -P6 -n 10 aws ec2 describe-instances --query 'Reservations[*].Instances[*].PrivateIpAddress' --output text --instance-ids \
| xargs -P6 -n 1 -I % ssh -o "UserKnownHostsFile=/dev/null" -o "StrictHostKeyChecking=no" % docker image prune -a -f
@ekesken
Copy link
Author

ekesken commented Apr 8, 2020

just select table content below
Screenshot 2020-04-08 at 12 37 49
and copy-paste it into /tmp/copy-pasted-text-from-browser.txt and then run the script.

you need to have this setting in your ssh_config:

Host 10.57.*
   ProxyCommand ssh -W %h:%p bastion.cre-pro.schibsted.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment