Every day when my spirit is polluted Every day I think about what to do with backup.
When I was looking for it, I found something called Bakthat. Encrypts the specified directory and also It also has a function to back up to S3 or Glacier.
First, let's build the environment. Since we are using boto, the environment must be Python 2.x. This time, we have confirmed the operation with 2.7.5.
> mkdir -p ~/Sandbox/bakthat
> cd ~/Sandbox/bakthat
> virtualenv-2.7 .venv
> source ~/.venv/bin/activate
> easy_install bakthat
> rehash
It's a cheap and secure backup destination, and when it comes to cloud computing, there is only S3 ... I have backups and S3 across 3 regions. It's possible to transfer it to Glacier over time.
Prepare the API_KEY and API_SECRET_KEY of AWS S3 as they are required. To prepare, create a user to back up to S3 with AWS IAM, It is recommended to create a user for testing.
I will omit the creation method. (I will take a screenshot if I have time)
If you type the following command, Enter a dialogue state. At that time, enter AWS_KEY and API_SECRET_KEY. Also, the default backup destination setting should be set for S3. (You can fly it to Glacier by setting the S3 bucket) I did that.
> bakthat configure
> AWS Access Key: XXXXXXXXXXXXXXXXXXXXXXXX
> AWS Secret Key: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> S3 Bucket Name: bakthat-test
> Glacier Vault Name: bakthat-test
> Default destination (s3):
> Region Name (us-east-1): us-west-2
> Config written in /Users/matsuzakikeiji/.bakthat.yml
> Run bakthat configure_backups_rotation if needed.
I want to test the backup, so Create the directory you want to use for testing.
> mkdir -p ~/Sandbox/bakthat/hoge
> cd ~/Sandbox/bakthat
Create an appropriate file in the hoge directory you created.
> echo "Hello..." > hoge/poem.txt
Type the following command to start the backup. At that time, you will be prompted to enter the password to encrypt the file.
> bakthat backup
Check if it is backed up from the AWS Management console. Access immediately.
there were. It's backed up! Was good.
Let's delete the hoge directory used for backup and restore it.
> rm -rf hoge
Then try to restore with bakthat. Of the encryption key entered at the time of backup at the time of restoration You will be prompted to enter it.
> bakthat restore hoge
It has been restored!
Poem is also perfect.
A similar tool is s3cmd,
Limit the backup destination bucket to one, and then
Personally, I just type the bakthat backup
command appropriately.
I think bakthat is good.
If you want to make fine backup adjustments (directory, creation bucket name, region selection), You can use boto or aws-sdk-ruby.
Recommended Posts