How to setup automatic scheduled snapshots for each single AMI/EBS?

后端 未结 5 1771
天命终不由人
天命终不由人 2021-02-08 04:38

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

相关标签:
5条回答
  • 2021-02-08 05:03

    AWS Management Console doesn't have a built-in automation for creating an maintaining EBS snapshots. You may try using scripts, third party cloud managment consoles with basic autommation of EBS snapshots or dedicated snapshot-based backup and recovery management solutions for EC2 instnaces & EBS volumes, available on the AWS marketplace or elsewhere.

    0 讨论(0)
  • 2021-02-08 05:05

    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)        
    
    0 讨论(0)
  • 2021-02-08 05:14

    AWS now proposes Data Lifecycle Management (see the documentation), which may help you. AWS defines it as a way to "Schedule and manage the creation and deletion of EBS snapshots"

    You can access it from the EC2 console and search for "Lifecycle Manager". Then you are guided to get started

    0 讨论(0)
  • 2021-02-08 05:17

    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

    0 讨论(0)
  • 2021-02-08 05:22

    I have created a small Perl program, https://github.com/sciclon/EBS_Snapshots

    Some features: * Program runs in daemon mode or script mode (crontab)

    • You can chose only local attached volumes or remotes as well

    • You can define log file

    • You can define for each volume quantity of snapshots

    • You can define for each volume the frequency among them

    • Frequency and quantity will work like a "round-robin" when it reaches the limit removing the oldest snapshot.

    • you can readjust in one step the quantity I mean if you have 6 snapshots and you modify the quantity in 3 the process will readjust it automatically.

    • You can define a "prescript" execution, You can add your code to execute before executing the snapshot, for example you would like to try to umount the volume or stop some service, or maybe to check the instance load. The parent process will wait for the exit code, "0" means success, you can define if continue or not depending on the exit code.

    • You can define a "postscript" execution to execute any scrip after taking the snapshot (for example a email telling you about it)

    • You can add "Protected Snapshots" to skip the snapshot you define, I mean they will be in "read only" and they will never been erased.

    • you can reconfigure the script "on the fly" when it is running in daemon mode, the script accepts signals and IPC.

    • It has a "local-cache" to avoid requesting the API several times. You can add or modify any configuration in the config file and reload without killing the process.

    0 讨论(0)
提交回复
热议问题