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, Config Files, or
Environment Variables. It is recommended to always use
Config Files as the same config can be used across tools and
languages.
To create a Connection
instance, use the
connect()
factory function.
def create_connection(auth_url, region, project_name, username, password):
return openstack.connect(
auth_url=auth_url,
project_name=project_name,
username=username,
password=password,
region_name=region,
app_name='examples',
app_version='1.0',
)
Full example at connect.py
Note
To enable logging, see the Logging user guide.
Now that you can create a connection, continue with the User Guides to work with an OpenStack service.
As an alternative to creating a Connection
using :ref:config-clouds-yaml, you can connect using
config-environment-variables.
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.