AWS Interface

The CloudWanderer AWS Interface.

class CloudWandererAWSInterface(cloudwanderer_boto3_session=None)

Simplifies lookup of Boto3 services and resources.

Parameters

cloudwanderer_boto3_session (Optional[cloudwanderer.aws_interface.session.CloudWandererBoto3Session]) –

Return type

None

__init__(cloudwanderer_boto3_session=None)

Simplifies lookup of Boto3 services and resources.

Parameters

cloudwanderer_boto3_session (Optional[cloudwanderer.aws_interface.session.CloudWandererBoto3Session]) – A CloudWandererBoto3Session session, if not provided the default will be used.

Return type

None

get_all_empty_resources(include_dependent_resource=False)

Return an empty_resource=True ServiceResource object for each resource type.

Parameters

include_dependent_resource – Whether or not dependent resources should be returned.

Return type

Iterator[boto3.resources.base.ServiceResource]

get_enabled_regions()

Return the list of regions enabled.

Fulfils the interface requirements for cloudwanderer.cloud_wanderer.CloudWanderer to call.

Return type

List[str]

get_resource(urn, include_dependent_resources=True)

Yield the resource picked out by this URN and optionally its subresources.

Parameters
  • urn (URN) – The urn of the resource to get.

  • include_dependent_resources (bool) – Whether or not to additionally yield the dependent_resources of the resource.

Raises
  • UnsupportedResourceTypeError – Occurs when we try to get an unsupported resource type.

  • botocore.exceptions.ClientError – Raises from Boto3 client.

Return type

Iterator[cloudwanderer.cloud_wanderer_resource.CloudWandererResource]

get_resources(service_name, resource_type, region, **kwargs)

Return all resources of resource_type from Boto3.

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

  • resource_type (str) – The type of resource to get resources of (e.g. 'instance')

  • region (str) – The region to get resources of (e.g. 'eu-west-1')

  • **kwargs – Additional keyword arguments will be passed down to the Boto3 client.

Raises

botocore.exceptions.ClientError – Occurs if the Boto3 Client Errors.

Return type

Iterator[cloudwanderer.cloud_wanderer_resource.CloudWandererResource]

class CloudWandererBoto3Session(aws_access_key_id=None, aws_secret_access_key=None, aws_session_token=None, region_name=None, botocore_session=None, profile_name=None, resource_factory=None, service_mapping_loader=None)

Subclass of Boto3 Session class to provide additional helper methods.

Parameters

service_mapping_loader (botocore.loaders.Loader) –

Return type

None

get_account_id()

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

Return type

str

get_enabled_regions()

Return a list of enabled regions in this account.

Return type

List[str]