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
- In your DreamHost panel, navigate to the (Panel > 'Cloud Services' > 'DreamObjects') page.
- Click your username to view your buckets and keys.
- View the following article for instructions on how to locate your Key pair.
- Copy the key pair to text editor such as Notepad.
- Log into your website via SSH.
- Navigate to your user's home directory.
[server]$ cd ~
- Use 'touch' to create a blank file titled .boto (note the leading dot). This file will stores your Keys.
[server]$ touch .boto
- 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 [Credentials] 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( host='objects-us-west-1.dream.io', )
You only need this single line because the Access and Secret keys are already in the .boto file.