Skip to content

Instantly share code, notes, and snippets.

@nicosnyman
nicosnyman / change_instance.sh
Created May 19, 2015 08:59
Easily change instance types on AWS EC2 with a bash script
#!/bin/bash
# Nico Snyman, nico@gammafly.com, 14/05/2015
# Change an instance type, while keeping snapshots
# This script will stop an instance identified by instance ID,
# take snapshots of all atached volumes, and restart it
# Use:
# -i instance ID - REQUIRED - stored in instance_id
# -t instance new instance type - REQUIRED - stored in instance_type
# -s if set to 0, no snapshot will be taken, dafault is 1
# (take snapshot of attached volumes) - stored in snapshot
#!/bin/bash
# Heavily adapted by Nico
# Original script:
# http://www.stardothosting.com/blog/2012/05/automated-amazon-ebs-snapshot-backup-script-with-7-day-retention/
### ebs-snapshot.sh
# Usage: $PROGNAME [OPTION] [Args]
#Take snapshot of AWS volumes marked with a specific tag.
#