Skip to content
Shell Script to auto make AMI backup and delete old backups for Amazon Linux.
Branch: master
Clone or download
Latest commit 2b534ae Jun 17, 2015
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE.txt Update Mar 9, 2015


Shell Script to auto make AMI backup and delete old backups.


  1. You need install AWS tools at your system.
    You can use yum install aws* to install all require packages.
    And please make sure your AWS tools install path is same with this script path.
  2. Please use "env | grep EC2_HOME" to find out your system's setting.
  3. Please use "env | grep JAVA_HOME" to find out your system's setting.
  4. Please add IAM role with appropriate permissions and launch instance with this IAM Role.
    If you are not familiar with IAM Role, you can create a admin IAM Role for quick use.

Shell Scripts vairables

  1. region: Reference
  2. instanceID: You can find your instance ID at AWS Manage Console
  3. amiNamePrefix: Your prefer AMI name prefix
  4. amiDescription: Your prefer AMI description
  5. routine: If you want to keep 7 days AMI backups, please set this variable true otherwise set it false.

About routine

  1. If you set routine false, this script will delete all your exist AMIs and Snapshots.
  2. If you set routine true, AMI name will be $amiNamePrefix+$weekday.
    for example, if you set $amiNamePrefix as "My AMI Backup " and set routine true.
    then your AMI name will be "My AMI Backup Mon" (without quotation marks).

None Amazon Linux

If you use none Amazon Linux, please visit:

You can’t perform that action at this time.