I had to create and use an AWS S3 bucket. I decided to use s3cmd tool to access this bucket.
You can find this tool at: • http://s3tools.org/s3cmd.
Install s3cmd
root@blackbox:~/ec2# apt-get install s3cmd Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: s3cmd 0 upgraded, 1 newly installed, 0 to remove and 4 not upgraded. Need to get 58.8 kB of archives. After this operation, 303 kB of additional disk space will be used. Get:1 http://us.archive.ubuntu.com/ubuntu/ oneiric/universe s3cmd all 1.0.0-1 [58.8 kB] Fetched 58.8 kB in 1s (55.5 kB/s) Selecting previously deselected package s3cmd. (Reading database ... 154045 files and directories currently installed.) Unpacking s3cmd (from .../archives/s3cmd_1.0.0-1_all.deb) ... Processing triggers for man-db ... Setting up s3cmd (1.0.0-1) ... root@blackbox:~/ec2#
Check the command is there
root@blackbox:~/ec2# s3cmd ERROR: /root/.s3cfg: No such file or directory ERROR: Configuration file not available. ERROR: Consider using --configure parameter to create one. root@blackbox:~/ec2#
Configure s3cmd
Get the information
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@blackbox:~/ec2# 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@blackbox:~/ec2#
Create the S3 bucket
root@blackbox:~/ec2# s3cmd mb s3://ludo$$ Bucket 's3://ludo9166/' created root@blackbox:~/ec2#
Put a public file on this bucket
root@blackbox:/tmp# s3cmd --acl-public put first-boot.sh s3://ludo9166 first-boot.sh -> s3://ludo9166/first-boot.sh [1 of 1] 1685 of 1685 100% in 0s 4.12 kB/s done Public URL of the object is: http://ludo9166.s3.amazonaws.com/first-boot.sh root@blackbox:/tmp#
Check the file is there
root@blackbox:/tmp# s3cmd ls s3://ludo9166 2012-02-09 03:26 1685 s3://ludo9166/first-boot.sh root@blackbox:/tmp#
Get the file through s3cmd
root@blackbox:/tmp# s3cmd get s3://ludo9166/first-boot.sh
Get the file through basic http request
root@blackbox:/tmp# curl -O http://ludo9166.s3.amazonaws.com/first-boot.sh

