How to set automatic backup drive
When using AWS EC2, I found that there is no ready interface for creating backup copies of the disk, which in AWS is called a Snapshot.
I started my research how to configure automatic updates. Read a lot of material and came to the conclusion that simple solutions no. You need to read a lot of documentation that would be all to configure. I understand that without it no where. Read docks, a big part of your life as a developer and administrator. But sometimes, things can be much simpler and do not need to spend much time on what can be done in just a few minutes.
Offer the option settings in 10 steps, without installing and setting AWS Command Line Tools.
It is assumed that the command
Open SSH and go to the folder.
the
Copy the finished code, which I created and which is on github in the folder
the
And go to this folder.
the
Make the file
the
Now we need to open releases page AWS PHP SDK on github, copy the link of the latest release on the green download button. And now downloaded it to disk.
the
Unzip the archive to a folder aws.
the
Edit the file
the
I think that settings are clear to all. Be sure to specify the region. If you have several disks, then they can all add to an array.
Let's check how it works.
the
Open control panel, AWS and verify that the Snapshot was created.
Add the task in cron. And no matter how often it will be performed. Even if you put it once a minute, the created snapshot will only ukazanomu time in the settings. But of course if the settings you specified
the
Article based on information from habrahabr.ru
I started my research how to configure automatic updates. Read a lot of material and came to the conclusion that simple solutions no. You need to read a lot of documentation that would be all to configure. I understand that without it no where. Read docks, a big part of your life as a developer and administrator. But sometimes, things can be much simpler and do not need to spend much time on what can be done in just a few minutes.
Offer the option settings in 10 steps, without installing and setting AWS Command Line Tools.
It is assumed that the command
git
and wget
is available.Step 1
Open SSH and go to the folder.
the
$ cd /usr/local/
Step 2
Copy the finished code, which I created and which is on github in the folder
ec2
.the
$ git clone https://gist.github.com/9738785.git ec2
Step 3
And go to this folder.
the
$ cd ec2
Step 4
Make the file
backup.php
executable.the
$ chmod +x backup.php
Step 5
Now we need to open releases page AWS PHP SDK on github, copy the link of the latest release on the green download button. And now downloaded it to disk.
the
$ wget https://github.com/aws/aws-sdk-php/releases/download/2.6.0/aws.zip
Step 6
Unzip the archive to a folder aws.
the
$ unzip aws.zip -d aws
Step 7
Edit the file
backup.php
. We are interested in rows 5-12.the
$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";
I think that settings are clear to all. Be sure to specify the region. If you have several disks, then they can all add to an array.
Step 8
Let's check how it works.
the
$ ./backup.php
Step 9
Open control panel, AWS and verify that the Snapshot was created.
Step 10
Add the task in cron. And no matter how often it will be performed. Even if you put it once a minute, the created snapshot will only ukazanomu time in the settings. But of course if the settings you specified
12 hours
and the crowns put time in 24 hours, it will not work. You need to make sure that the task is triggered Krona according to your preference. For my example, every 24 hours is sufficient.the
* 23 * * * /usr/local/ec2/backup.php