Creating a .boto file to store your keys

boto is an rsync-like tool that allows you to upload or download data to DreamObjects. When using boto, you must specify several credentials including your Access Key and Secret Key.

Instead of inputting these credentials into every script, an alternative is to create a .boto file in your user's home directory. Then you can reference this file in any script to use your credentials.

Creating a .boto config file

  1. In your DreamHost panel, navigate to the DreamObjects page.
  2. Click your username to view your buckets and keys.
  3. View the following article for instructions on how to locate your Key pair.
  4. Copy the key pair to text editor such as Notepad.
  5. Log into your website via SSH.
  6. Navigate to your user's home directory.
    [server]$ cd ~
  7. Use 'touch' to create a blank file titled .boto (note the leading dot). This file will stores your Keys.
    [server]$ touch .boto
  8. Take the Access and Secret key pair you copied above and enter them into the commands below. These commands add the keys to your .boto file.
    [server]$ echo [Credentials] >> ~/.boto
    [server]$ echo aws_access_key_id = 98F3n8qUtWEJ6ZdBYyQy >> ~/.boto
    [server]$ echo aws_secret_access_key = p5kptXKQrsQtTNJTYtG7emGYooXkN6Kaza1OV >> ~/.boto

Confirm the .boto file contains your keys

Use 'cat' to read the .boto file. It should output your keys as shown below:

[server]$ cat .boto
aws_access_key_id = 98F3n8qUtWEJ6ZdBYyQy
aws_secret_access_key = p5kptXKQrsQtTNJTYtG7emGYooXkN6Kaza1OV

Using the .boto file in your scripts

Now that the .boto file is created, you can create a connection to DreamObjects using the following:

connection = boto.connect_s3(

You only need this single line because the Access and Secret keys are already in the .boto file.

Did this article answer your questions?

Article last updated PST.