Skip to content

Instantly share code, notes, and snippets.

@the-darkvoid
Created September 12, 2021 04:15
Show Gist options
  • Save the-darkvoid/951aa495510895dae15d6716a50d5fc0 to your computer and use it in GitHub Desktop.
Save the-darkvoid/951aa495510895dae15d6716a50d5fc0 to your computer and use it in GitHub Desktop.
Clear AWS Instances + IPs
aws ec2 terminate-instances --instance-ids `aws ec2 describe-instances --filters "Name=image-id,Values=ami-0ceee60bcb94f60cd" --query "Reservations[*].Instances[*].InstanceId" --output text`
for ip in `aws ec2 describe-addresses --query "Addresses[*].AllocationId" --output text`; do aws ec2 release-address --allocation-id $ip; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment