Back Up files to AWS S3

This article explains about , how to copy backup files into AWS s3

Hello all. Recently i faced a problem to take back up of files or databases dumps into amazon s3 bucket.

Hoping you have amazon account and created s3 bucket for you.

Now what you need to do is

create secret keys and access key for your AWS account here for user creation.

Install s3 command tool

sudo apt-get install s3cmd

Configure s3cmd

 s3cmd --configure

It will ask access_key and secret_key and use https like this

Enter new values or accept defaults in brackets with Enter.
Refer to user manual for detailed description of all options.

Access key and Secret key are your identifiers for Amazon S3
Access Key: xxxxxxxxxxxxxxxxxxxxxx
Secret Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Encryption password is used to protect your files from reading
by unauthorised persons while in transfer to S3
Encryption password: xxxxxxxxxx
Path to GPG program [/usr/bin/gpg]:

When using secure HTTPS protocol all communication with Amazon S3
servers is protected from 3rd party eavesdropping. This method is
slower than plain HTTP and can't be used if you're behind a proxy
Use HTTPS protocol [No]: Yes

New settings:
Access Key: xxxxxxxxxxxxxxxxxxxxxx
Secret Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Encryption password: xxxxxxxxxx
Path to GPG program: /usr/bin/gpg
Use HTTPS protocol: True
HTTP Proxy server name:
HTTP Proxy server port: 0

Test access with supplied credentials? [Y/n] Y
Please wait, attempting to list all buckets...
Success. Your access key and secret key worked fine :-)

Now verifying that encryption works...
Success. Encryption and decryption worked fine :-)

Save settings? [y/N] y
Configuration saved to '/root/.s3cfg'

Copy file from your instance to s3 bucket by this command

  s3cmd put source-file-path s3://yourbucketname/

For example

s3cmd test.txt s3://balaji/

test.txt -> source file 
balaji -> bucket-name

You can check s3bucket and verify data is copied successfully or not.

Thanks I hope it helps.  

Leave a comment

(Note: Comments are moderated)