Last active
January 8, 2019 22:33
-
-
Save iAnomaly/1f878f5f2fe1591963338f5087914104 to your computer and use it in GitHub Desktop.
Shell one-liners
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
# AWS NAT Gateways per AZ | |
aws ec2 describe-nat-gateways | jq -r '.NatGateways[]|select(.State=="available").SubnetId' | xargs aws ec2 describe-subnets --subnet-id | jq -r '.Subnets[].AvailabilityZone' | sort | uniq -c | |
# SSH command across all EC2 instance with name tag using bastion/jump-box and dumping 1024 DNS queries to EC2 DNS | |
aws --output text ec2 describe-instances --query 'Reservations[].Instances[?Tags[?Key==`Name`&&contains(Value,`my-name`)]].PrivateDnsName' | xargs -I % -n 1 -P $(sysctl -n hw.ncpu) ssh -i ~/.ssh/key.pem -o IdentitiesOnly=yes -o StrictHostKeyChecking=no -J ubuntu@bastion.name admin@% "uname -n; sudo /usr/sbin/tcpdump -i eth0 -lnc 1024 dst 172.29.0.2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment