Amazon S3 is a reasonably priced data storage service. Ideal for off-site backups, archiving and other data storage needs. S3cmd is a command line tool for uploading, retrieving and managing data in Amazon S3. S3cmd is an open source project available under GNU Public License v2 (GPLv2) and is free for both commercial and private use. You will only have to pay Amazon for using their storage.
Installation of s3cmd package
S3tools / S3cmd project homepage:
http://s3tools.sourceforge.net
Amazon S3 homepage:
http://aws.amazon.com/s3
Installation of RPM package
---------------------------
As user "root" run:
rpm -ivh s3cmd-X.Y.Z.noarch.rpm
where X.Y.Z is the most recent s3cmd release version.
Installation of source .tar.gz package
--------------------------------------
There are three options to run s3cmd from source tarball:
1) S3cmd program as distributed in s3cmd-X.Y.Z.tar.gz
can be run directly from where you untar'ed the package.
2) Or you may want to move "s3cmd" file and "S3" subdirectory
to some other path. Make sure that "S3" subdirectory ends up
in the same place where you move the "s3cmd" file.
For instance if you decide to move s3cmd to you $HOME/bin
you will have $HOME/bin/s3cmd file and $HOME/bin/S3 directory
with a number of support files.
3) The cleanest and most recommended approach is to run
python setup.py install
You will however need Python "distutils" module for this to
work. It is often part of the core python package (e.g. in
OpenSuse Python 2.5 package) or it can be installed using your
package manager, e.g. in Debian use
apt-get install python2.4-setuptools
Configure S3cmd:
To configure s3cmd, you need two information: • Access Key • Secret Key
You can get these credentials from: •
https://aws-portal.amazon.com/gp/aws/securityCredentials
Run “s3cmd –configure” command
[root@ip-XXX-XX-XX-XX ~]# s3cmd --configure
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: __[Your Access Key]__
Secret Key: __[Your Secret Key]__
Encryption password is used to protect your files from reading
by unauthorized persons while in transfer to S3
Encryption password: __[Your passphrase to protect your Secret Key]__
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: [Your Access Key]
Secret Key: [Your Secret Key]
Encryption password: [Your passphrase to protect your Secret Key]
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]
Please wait...
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'
[root@ip-XXX-XX-XX-XX ~]#
Create the S3 bucket:
[root@ip-XXX-XX-XX-XX ~]#s3cmd mb s3://test123
Bucket 's3://test123/' created
[root@ip-XXX-XX-XX-XX ~]#
Put a public file on this bucket:
[root@ip-XXX-XX-XX-XX ~]#s3cmd --acl-public put video1.mp4 s3://test123
video1.mp4 -> s3://test123/video1.mp4 [1 of 1]
1685 of 1685 100% in 0s 4.12 kB/s done
Public URL of the object is: http://test123.s3.amazonaws.com/video1.mp4
[root@ip-XXX-XX-XX-XX ~]#
Or can use the below command
s3cmd --config=/root/.s3cfg put --acl-public videos1.mp4 s3://test123
Listing files:
[root@ip-XXX-XX-XX-XX ~]# s3cmd ls s3://test123
2012-02-09 03:26 1685 s3://test123/video1.mp4
[root@ip-XXX-XX-XX-XX ~]#
Get files through s3cmd:
[root@ip-XXX-XX-XX-XX ~]# s3cmd get s3://test123/video1.mp4
For more details please go through the url, http://s3tools.org/s3cmd
No comments:
Post a Comment