[PYTHON] Bakthat is good for backup, isn't it?

Every day I think about backup ...

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.

Bakthat documentation

bakthat install

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

Try backing up to S3

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.

AWS side settings

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)

bakthat initial settings

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
> 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.

Backup test by bakthat

Create test file for backup

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

Hoija backup

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

bakthat backup

Check if it is backed up

Check if it is backed up from the AWS Management console. Access immediately.

S3 backup

there were. It's backed up! Was good.

Challenge to restore

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

S3 restore

It has been restored!

cat poem.txt

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

Bakthat is good for backup, isn't it?
What is Python? What is it used for?
chmod 600 ← 600 isn't it?
Is there a good sample code for nosetests?
-Delete is good for deleting files searched by find
ML flow Tracking is good even for personal use
Is it Google Colaboratory?
Scrapy is good talk
What is Linux for?