CloudBridge

raw JSON →
3.2.0 verified Mon Apr 27 auth: no python

CloudBridge provides a unified abstraction layer over multiple cloud providers (AWS, GCP, Azure, OpenStack), enabling multi-cloud deployments with a single API. Current version 3.2.0, released 2025-03-15; releases occur every few months.

pip install cloudbridge
error ModuleNotFoundError: No module named 'cloudbridge'
cause cloudbridge not installed or installed in a different environment.
fix
pip install cloudbridge
error AttributeError: 'CloudProvider' object has no attribute 'instances'
cause In version 3+, instances is under provider.compute.instances, not directly on provider.
fix
Use provider.compute.instances.list() or provider.compute.instances.all()
error cloudbridge.exceptions.ProviderConnectionError: Unable to connect to provider. Check credentials.
cause Invalid or missing credentials, or incorrect region/endpoint.
fix
Verify environment variables (e.g., OS_USERNAME, AWS_ACCESS_KEY_ID) are set correctly and the provider is reachable.
breaking In version 3.0, the API was redesigned. Crucial changes: 'CloudProvider' now requires a provider string ('aws', 'gcp', 'azure', 'openstack'); old cloudbridge.aws.* patterns no longer work.
fix Update imports: use from cloudbridge.cloud import CloudProvider and instantiate with provider name.
breaking In version 3.0, the 'compute', 'storage', 'network' services are accessed via provider.compute, provider.storage, provider.network (not provider.compute.instances? None, but resource methods changed). For example: 'instances.list()' returns paginated results; use .all() for all instances or iterate.
fix Review the new resource hierarchy in the docs. For listing all instances: provider.compute.instances.all() or iterate over pages.
deprecated The 'dns' service (provider.dns) has been deprecated and will be removed in a future version. Use provider.network.dns instead.
fix Use provider.network.dns instead of provider.dns.
gotcha When using AWS, the region must be set via an environment variable or explicitly in the provider configuration; CloudBridge does not default to us-east-1. If not set, operations may fail with region-related errors.
fix Set AWS_DEFAULT_REGION environment variable or pass region in config dict: CloudProvider('aws', config={'region_name': 'us-west-2'})
gotcha For OpenStack, the credential environment variables are OS_* (e.g., OS_USERNAME). Using other cloud provider env vars (AWS_*) will not work; you must use the correct ones for each provider.
fix Refer to the CloudBridge docs for the exact environment variable names per provider.
pip install cloudbridge[aws,gcp,azure,openstack]

Initialises a CloudProvider using OpenStack credentials from environment variables and lists compute instances.

import os
from cloudbridge.cloud import CloudProvider

# Set credentials via environment variables
os.environ['OS_AUTH_URL'] = 'your-auth-url'
os.environ['OS_USERNAME'] = 'your-username'
os.environ['OS_PASSWORD'] = 'your-password'
os.environ['OS_PROJECT_NAME'] = 'your-project'

# Create a provider (OpenStack here, but could be AWS, GCP, etc.)
provider = CloudProvider('openstack')

# List instances
for instance in provider.compute.instances.list():
    print(instance.id, instance.name)