In order to work with an OpenStack cloud you first need to create a
Connection
to it using your credentials. A
Connection
can be
created in 3 ways, using the class itself (see Connect), a file, or
environment variables as illustrated below. The SDK uses
os-client-config
to handle the configuration.
Note
To get your credentials Download the OpenStack RC file.
To create a connection from a file you need a YAML file to contain the configuration.
clouds:
test_cloud:
region_name: RegionOne
auth:
auth_url: http://xxx.xxx.xxx.xxx:5000/v2.0/
username: demo
password: secrete
project_name: demo
example:
image_name: fedora-20.x86_64
flavor_name: m1.small
network_name: private
rackspace:
cloud: rackspace
auth:
username: joe
password: joes-password
project_name: 123123
region_name: IAD
To use a configuration file called clouds.yaml
in one of the default
locations:
call from_config()
. The from_config
function takes three optional arguments, such as cloud_name,
which allows you to specify one set of cloud credentials in your
clouds.yaml
file. Additionally, cloud_config and options
allow you to pass in configiration data you may have already received
from os-client-config
, as well as additional options that the
os-client-config
library may need.
Note
To enable logging, set debug=True
in the Opts
object.
To use a configuration file in a user defined location set the
environment variable OS_CLIENT_CONFIG_FILE
to the
absolute path of a file.:
export OS_CLIENT_CONFIG_FILE=/path/to/my/config/my-clouds.yaml
and call from_config()
with the cloud_name
of the cloud configuration to use, .
Now that you can create a connection, continue with the User Guides for an OpenStack service.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.