Skip to content

Instantly share code, notes, and snippets.

@finger-berlin
Created September 25, 2014 15:26
Show Gist options
  • Save finger-berlin/307f45cafb71010ab6c8 to your computer and use it in GitHub Desktop.
Save finger-berlin/307f45cafb71010ab6c8 to your computer and use it in GitHub Desktop.
AWS EC2 automated backup into AMIs
for h in $(ec2-describe-instances --filter instance-state-name=running | grep -iv stack | grep -iv autoscaling | grep Name | cut -f3,5 | tr "\t" ":" );
do echo $h;
INSTANCE=$(echo $h|cut -d: -f1);
INAME=$(echo $h|cut -d: -f2);
ec2-create-image $INSTANCE --name $INAME.$(date +%Y%m%d) --description $INAME.$(date +%Y%m%d) --no-reboot;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment