Connect

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.

Create Connection

To create a Connection instance, use the connect() factory function.

def create_connection(
    auth_url,
    region,
    project_name,
    username,
    password,
    user_domain,
    project_domain,
):
    return openstack.connect(
        auth_url=auth_url,
        project_name=project_name,
        username=username,
        password=password,
        region_name=region,
        user_domain_name=user_domain,
        project_domain_name=project_domain,
        app_name='examples',
        app_version='1.0',
    )

Full example at connect.py

Note

To enable logging, see the Logging user guide.

Next

Now that you can create a connection, continue with the User Guides to work with an OpenStack service.