Created
April 19, 2016 19:35
-
-
Save Kgirthofer/c9d58dac57d610cc29023e93eb507694 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
arr=($(aws ec2 describe-instances --filters "Name=tag-key,Values=Purge" --output table | grep InstanceId | awk '{print $4}')) | |
for index in "${!arr[@]}" | |
do | |
purge_time=$(aws ec2 describe-instances --instance-ids ${!arr[index]}) | |
if $purge_time = 24h; then | |
printf "got one" | |
fi | |
printf "deleting server %s\n" ${arr[index]} | |
aws ec2 terminate-instances --instance-ids ${arr[index]} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment