Does Amazon support any kind of automatic scheduled snapshots that can be configured for each single AMI/EBS?
my goal is to have each AMI backup itself regularly without relying on external scripts and similar.
To create an automated snapshot lifecycle policy, you need to first select Lifecycle Manager from your EC2 dashboard. Under Policies, select Create Snapshot Lifecycle Policy. From there, you can enter the details of your policy.
To create a snapshot policyOpen the Amazon EC2 console at https://console.aws.amazon.com/ec2/ . In the navigation pane, choose Elastic Block Store, Lifecycle Manager, and then choose Create lifecycle policy. On the Select policy type screen, choose EBS snapshot policy and then choose Next.
During the AMI-creation process, Amazon EC2 creates snapshots of your instance's root volume and any other EBS volumes attached to your instance. You're charged for the snapshots until you deregister the AMI and delete the snapshots.
You can use the AWS command-line tools to automate EBS snapshots. Just schedule a cron job or similar to run ec2-create-snapshot
command at the desired interval on your ebs volume.
You can also make API calls over http to do the same thing, if you don't want to install the command line tools.
See the link for more information on creating EBS snapshots.
http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/ebs-creating-snapshot.html
use this python code
from boto.ec2.connection import EC2Connection
from datetime import datetime
import sys
if __name__ == '__main__':
conn = EC2Connection('aws_access_key_id', 'aws_secret_access_key')
volumes_id={'vol-2354534'}
description = 'Created by crontab at ' + datetime.today().isoformat(' ')
for vol_id in volumes_id :
snapshot = conn.create_snapshot( vol_id ,description)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With