Storage Connector Reference¶
DynamoDB Connector¶
-
class
cloudwanderer.storage_connectors.
DynamoDbConnector
(table_name='cloud_wanderer', endpoint_url=None, boto3_session=None, number_of_shards=10)¶ CloudWanderer Storage Connector for DynamoDB.
- Parameters
table_name (str) – The name of the table to store resources in.
endpoint_url (str) – Optional override endpoint url for DynamoDB.
boto3_session (boto3.Session) – Optional boto3 session to use to interact with DynamoDB. Useful if your DynamoDB table is in a different account/region to your configured defaults.
number_of_shards (int) – The number of shards to break records across low-cardinality indices. Prevents hot-partitions. If you don’t know what this means, ignore this setting.
-
delete_resource
(urn)¶ Delete the resource and all its resource attributes from DynamoDB.
-
delete_resource_of_type_in_account_region
(service, resource_type, account_id, region, urns_to_keep=None)¶ Delete resources of type in account id unless in list of URNs.
-
init
()¶ Create the DynamoDB Database.
-
read_all
()¶ Return raw data from all DynamoDB table records (not just resources).
-
read_all_resources_in_account
(account_id)¶ Return all resources in account.
- Parameters
account_id (str) – AWS Account ID
-
read_resource
(urn)¶ Return the resource with the specified
cloudwanderer.AwsUrn
.- Parameters
urn (cloudwanderer.AwsUrn) – The AWS URN of the resource to return
-
read_resource_of_type
(service, resource_type)¶ Return all resources of type.
- Parameters
service (str) – Service name (e.g. ec2)
resource_type (str) – Resource Type (e.g. instance)
-
read_resource_of_type_in_account
(service, resource_type, account_id)¶ Return all resources of the specified type in the specified AWS account.
- Parameters
service (str) – Service name, e.g.
ec2
resource_type (str) – Resouce type, e.g.
instance
account_id (str) – AWS Account ID
-
write_resource
(urn, resource)¶ Write the specified resource to DynamoDB.
- Parameters
urn (cloudwanderer.AwsUrn) – The URN of the resource.
resource – The boto3 Resource object representing the resource.
-
write_resource_attribute
(urn, attribute_type, resource_attribute)¶ Write the specified resource attribute to DynamoDb.