6

Creating a .boto file to store your keys

 3 years ago
source link: https://help.dreamhost.com/hc/en-us/articles/115000376631-Creating-a-boto-file-to-store-your-keys
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Creating a .boto file to store your keys

Overview

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.

dh-kb-important-icon.svg

Boto-rsync is outdated software and is no longer maintained. It will also be removed from the latest version of Ubuntu Bionic. DreamHost recommends using s3cmd instead, and you can find out more about how to use s3cmd at DreamHost in the following article:

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 a 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 store 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
[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-east-1.dream.io',
)

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

Did this article answer your questions?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK