DEV Community

Cover image for Upload backups to AWS Glacier
Juan Carizza
Juan Carizza

Posted on

Upload backups to AWS Glacier

with a worth of $0.004 per GB of storage AWS Glacier is a good choice to store backups.

The problem is that you need to do some extra work to upload one file, but one library resolve all of it.

The library support Python>3.5, you can install pyenv to handle python versions to add the python version supported by this library glacier-upload.

Install pyenv for Python version handler if you've a version of python <3.5

 curl https://pyenv.run | bash
Enter fullscreen mode Exit fullscreen mode

Create a virtualenv to install dependencies

pyenv install 3.5.9
pyenv virtualenv 3.5.9 glacier
pyenv activate glacier
(glacier) pip install upload_glacier
Enter fullscreen mode Exit fullscreen mode

Configure amazon boto credentials

vim ~/.aws/credentials
[default]
aws_access_key_id=AKIA2DECGLYHEBIJDI7D
aws_secret_access_key=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
region=us-west-2
Enter fullscreen mode Exit fullscreen mode

Upload first backup. (The files take some minutes to appear listed in the vault)

(glacier) webuser@scully:~# glacier_upload  --vault-name backups-server-1 -f backup.tar.gz
Reading file...
Opened single file.
Initiating multipart upload...
File size is 1336872 bytes. Will upload in 1 parts.
Spawning threads...
Uploading part 1 of 1... (0.00%)
Completing multipart upload...
Upload successful.
Calculated total tree hash: d627aea450fde4f3c97ff63a5298c012dab73874e4cd443d9b0cf8466e7b0ade
Glacier total tree hash: d627aea450fde4f3c97ff63a5298c012dab73874e4cd443d9b0cf8466e7b0ade
Location: /693910265358/vaults/backups-nd-1/archives/i7CWC_v5uhohwh9VX1QYQdVeYjy533DXp6t7XJ6um3d7uKiCoJt6cydBAKTwfR9CfDnyEIQCN2Xo43FP6xmt3gz_87eCxd5tAsEBEZzR1vjgUUaHmAtdeDqSrKX8rPwT-2_GEZpWnA
Archive ID: i7CWC_v5uhohwh9VX1QYQdVeYjy533DXp6t7XJ6um3d7uKiCoJt6cydBAKTwfR9CfDnyEIQCN2Xo43FP6xmt3gz_87eCxd5tAsEBEZzR1vjgUUaHmAtdeDqSrKX8rPwT-2_GEZpWnA
Done.
Enter fullscreen mode Exit fullscreen mode

Top comments (0)