Client

What is this?

With the following clients you can use them as context managers and they provide extra functionality for you. Each client is documented below:

Classes

class betterboto.client.ClientContextManager(service_name, **kwargs)[source]

ClientContextManager allows you to use boto3 client as a python context manager. This allows you to perform the following:

with ClientContextManager('cloudformation') as cloudformation_client:
    cloudformation_client.create_stack(**args)
class betterboto.client.CrossAccountClientContextManager(service_name, role_arn, role_session_name, **kwargs)[source]

CrossAccountClientContextManager allows you to use boto3 client as a python context manager for another account. This allows you to perform the following:

with CrossAccountClientContextManager(
    'cloudformation',
    'arn:aws:iam::0123456789010:role/deployer',
    'deployment_account_session',
) as deployment_account_cloudformation:
    deployment_account_cloudformation.create_stack(**args)
class betterboto.client.CrossMultipleAccountsClientContextManager(service_name, assumable_details, **kwargs)[source]

CrossMultipleAccountsClientContextManager allows you to use boto3 client as a python context manager for another account. This allows you to perform the following:

with CrossMultipleAccountsClientContextManager(
    'cloudformation',
    [
        ('arn:aws:iam::0123456789010:role/deployer', 'deployment_account_session'),
        ('arn:aws:iam::097167856333:role/deployer', 'deployment_account_session_nested'),
    ],
) as deployment_account_cloudformation:
    deployment_account_cloudformation.create_stack(**args)
class betterboto.client.MultiRegionClientContextManager(service_name, regions, **kwargs)[source]

MultiRegionClientContextManager allows you to use boto3 client as a python context manager for multiple regions. This allows you to perform the following:

with MultiRegionClientContextManager('cloudformation', ['us-east-1','eu-west-1']) as cloudformation_clients:
    for region_name, cloudformation_client in cloudformation_clients.items():
        cloudformation_client.create_stack(**args)

If you want to deploy to multiple regions at the same time then you should use Python Threads