CloudWanderer Reference

Main cloudwanderer module.

class CloudWanderer(storage_connectors, boto3_session=None)

CloudWanderer.

Parameters
property account_id

Return the AWS Account ID our boto3 session is authenticated against.

property enabled_regions

Return a list of enabled regions in this account.

write_resource_attributes(exclude_resources=None, client_args=None)

Write all AWS resource attributes in this account from all regions and all services to storage.

Parameters
  • exclude_resources (list) – A list of resource names to exclude (e.g. ['instance'])

  • client_args (dict) – Arguments to pass into the boto3 client. See: boto3.session.Session.client()

Return type

None

write_resource_attributes_in_region(exclude_resources=None, region_name=None, client_args=None)

Write all AWS resource attributes in this account in this region to storage.

These custom resource attribute definitions allow us to fetch resource attributes that are not returned by the resource’s default describe calls. Unlike write_resources() and write_resources_of_type_in_region() this method does not clean up stale resource attributes from storage.

Parameters
  • exclude_resources (list) – A list of resources not to write attributes for (e.g. ['vpc'])

  • region_name (str) – The name of the region to get resources from (defaults to session default if not specified)

  • client_args (dict) – Arguments to pass into the boto3 client. See: boto3.session.Session.client()

Return type

None

write_resource_attributes_of_service_in_region(service_name, exclude_resources=None, region_name=None, client_args=None)

Write all AWS resource attributes in this account in this service to storage.

These custom resource attribute definitions allow us to fetch resource attributes that are not returned by the resource’s default describe calls. Unlike write_resources() and write_resources_of_type_in_region() this method does not clean up stale resource attributes from storage.

Parameters
  • service_name (str) – The name of the service to write the attributes of (e.g. 'ec2')

  • exclude_resources (list) – A list of resources not to write attributes for (e.g. ['vpc'])

  • region_name (str) – The name of the region to get resources from (defaults to session default if not specified)

  • client_args (dict) – Arguments to pass into the boto3 client. See: boto3.session.Session.client()

Return type

None

write_resource_attributes_of_type_in_region(service_name, resource_type, region_name=None, client_args=None)

Write all AWS resource attributes in this account of this resource type to storage.

These custom resource attribute definitions allow us to fetch resource attributes that are not returned by the resource’s default describe calls.

Parameters
  • service_name (str) – The name of the service to write the attributes of (e.g. ec2)

  • resource_type (str) – The type of resource to write the attributes of (e.g. instance)

  • region_name (str) – The name of the region to get resources from (defaults to session default if not specified)

  • client_args (dict) – Arguments to pass into the boto3 client. See: boto3.session.Session.client()

Return type

None

write_resources(exclude_resources=None, client_args=None, concurrency=1)

Write all AWS resources in this account from all regions and all services to storage.

Parameters
  • exclude_resources (list) – A list of resource names to exclude (e.g. ['instance'])

  • client_args (dict) – Arguments to pass into the boto3 client. See: boto3.session.Session.client()

  • concurrency (int) – Number of query threads to invoke concurrently. If the number of threads exceeds the number of regions by at least two times multiple services to be queried concurrently in each region. WARNING: Experimental. Complete data capture depends heavily on the thread safeness of the storage connector and has not been thoroughly tested!

Return type

None

write_resources_in_region(exclude_resources=None, region_name=None, client_args=None)

Write all AWS resources in this account region from all services to storage.

Parameters
  • exclude_resources (list) – A list of resource names to exclude (e.g. ['instance'])

  • region_name (str) – The name of the region to get resources from (defaults to session default if not specified)

  • client_args (dict) – Arguments to pass into the boto3 client. See: boto3.session.Session.client()

Return type

None

write_resources_of_service_in_region(service_name, exclude_resources=None, region_name=None, client_args=None)

Write all AWS resources in this region in this service to storage.

Cleans up any resources in the StorageConnector that no longer exist.

Parameters
  • service_name (str) – The name of the service to write resources for (e.g. 'ec2')

  • exclude_resources (list) – A list of resource names to exclude (e.g. ['instance'])

  • region_name (str) – The name of the region to get resources from (defaults to session default if not specified)

  • client_args (dict) – Arguments to pass into the boto3 client. See: boto3.session.Session.client()

Return type

None

write_resources_of_type_in_region(service_name, resource_type=None, region_name=None, client_args=None)

Write all AWS resources in this region in this service to storage.

Cleans up any resources in the StorageConnector that no longer exist.

Parameters
  • service_name (str) – The name of the service to write resources for (e.g. 'ec2')

  • resource_type (str) – The name of the type of the resource to write (e.g. 'instance')

  • region_name (str) – The name of the region to get resources from (defaults to session default if not specified)

  • client_args (dict) – Arguments to pass into the boto3 client. See: boto3.session.Session.client()

Return type

None

class CloudWandererResource(urn, resource_data, resource_attributes=None, loader=None)

A simple representation of a resource that prevents any storage metadata polluting the resource dictionary.

Use dict(my_resource_dict) to convert this object into a dictionary that contains only the resource’s metadata.

urn

The AWS URN of the resource.

Type

cloudwanderer.aws_urn.AwsUrn

metadata

The original storage representation of the resource as it was passed in.

Type

dict

load()

Inflate this resource with all data from the original storage connector it was spawned from..

Return type

None

class ResourceMetadata(resource_data, resource_attributes)

Metadata for a CloudWandererResource.

Contains the original dictionaries of the resource and its attributes.

resource_data

The raw dictionary representation of the Resource.

Type

dict

resource_attributes

the list of raw dictionary representation of the Resource’s attributes.

Type

list