Installing & Configuring s3cmd
The simplest way to test the installation is using the
s3cmd script. We can install it on Ubuntu by typing:
sudo apt-get -y install s3cmd
For our OS X users, either use the package manager of your preference or download the S3 cmd package at http://s3tools.org/download. You will need to extract the
.tar file, change directories into the folder, and build the package. The process should look something like this:
tar -xvzf s3cmd-1.5.0-alpha1.tar.gz cd s3cmd-1.5.0-alpha1 sudo python setup.py install
You will be prompted to enter your system password. Enter it and then wait for the installation to complete.
We need to configure
s3cmd to use our Riak CS server rather than S3 as well as our user keys. To do that interactively, type the following:
s3cmd -c ~/.s3cfgfasttrack --configure
If you are already using
s3cmd on your local machine, the
-c switch allows you to specify a
.s3cfg file without overwriting anything you may have presently configured.
There are 4 default settings you should change:
- Access Key — Use the Riak CS user access key you generated above.
- Secret Key — Use the Riak CS user secret key you generated above.
- Proxy Server — Use your Riak CS IP. If you followed the Virtual environment configuration, use
- Proxy Port — The default Riak CS port is
You should have copied your Access Key and Secret Key from the prior installation steps.
Interacting with Riak CS via S3cmd
s3cmd is configured, we can use it to create a test bucket:
s3cmd -c ~/.s3cfgfasttrack mb s3://test-bucket
We can see if it was created by typing:
s3cmd -c ~/.s3cfgfasttrack ls
We can now upload a test file to that bucket:
dd if=/dev/zero of=test_file bs=1m count=2 # Create a test file s3cmd -c ~/.s3cfgfasttrack put test_file s3://test-bucket
We can see if it was properly uploaded by typing:
s3cmd -c ~/.s3cfgfasttrack ls s3://test-bucket
We can now download the test file. First, let's remove the file we generated previously:
Now, we can download the
test_filestored in Riak CS:
s3cmd -c ~/.s3cfgfasttrack get s3://test-bucket/test_file
We should immediately see output like this:
s3://test-bucket/test_file -> ./test_file [1 of 1] 2097152 of 2097152 100% in 0s 59.63 MB/s done
To verify that the file has been downloaded into the current directory:
ls -lah test_file
If you have made it this far, congratulations! You now have a working Riak CS test instance (either virtual or local). There is still a fair bit of learning to be done, so make sure and check out the Reference section (click “Reference” on the nav on the left side of this page). A few items that may be of particular interest: