Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Once in a while I would go to and manually right click my EBS volume and create a snapshot.

This is kind of tedious and I would forget sometimes. Is it possible to automate this actions and say, make a daily or weekly snapshot?

I'm using a Windows Server instance.

share|improve this question
up vote 3 down vote accepted

Use AMI Tools:

share|improve this answer
Excellent. Will look into this. Thanks – bruno077 Feb 18 '11 at 15:29

As an alternative to command line tools you may use PHP script developed by me. It is easier to setup as you do not need write even a line of code and you do not need to setup environment.

Not only this script create snapshots automatically, it can also delete old snapshots after given period of time.

How to setup

  1. Open SSH connection to your server.
  2. Navigate to folder

    $ cd /usr/local/
  3. Clon this gist into ec2 folder

    $ git clone ec2
  4. Go to that folder

    $ cd ec2
  5. Make backup.php executable

    $ chmod +x backup.php
  6. Open releases of the AWS PHP SDK github project and copy URL of button. Now download it into your server.

    $ wget
  7. Unzip this file into aws directory.

    $ unzip -d aws 
  8. Edit backup.php php file and set all settings in line 5-12. Pay attention on your region.

    $dryrun     = FALSE;
    $interval   = '24 hours';
    $keep_for   = '10 Days';
    $volumes    = array('vol-********');
    $api_key    = '*********************';
    $api_secret = '****************************************';
    $ec2_region = 'us-east-1';
    $snap_descr = "Daily backup";
  9. Test it. Run this script

    $ ./backup.php

    Check if snapshot is created.

  10. If everything is ok just add cronjob. I run it everyday on 23:00. because i use interval 24 hours. If you setup shorter interval, consider to trigger cronjob more often. You can even set it every 5 minutes. It will create new snapshot only with given interval anyway.

    * 23 * * * /usr/local/ec2/backup.php
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.