boto3_dynamodb

Connection module for Amazon DynamoDB using boto3.

Renamed from boto_dynamodb to boto3_dynamodb and rewritten to use the boto3 dynamodb client APIs directly via saltext.boto3.utils.boto3mod. The legacy boto2 code path (object-style access, retry loops) has been removed.

depends:
  • boto3 >= 1.28.0

  • botocore >= 1.31.0

configuration:

This module accepts explicit DynamoDB credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at:

http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html

If IAM roles are not used you need to specify them either in the minion’s config file or as a profile. For example, to specify them in the minion’s config file:

dynamodb.keyid: GKTADJGHEIQSXMKKRBJ08H
dynamodb.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

A region may also be specified in the configuration:

dynamodb.region: us-east-1

It’s also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config:

myprofile:
    keyid: GKTADJGHEIQSXMKKRBJ08H
    key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
    region: us-east-1

Added in version 1.0.0.

saltext.boto3.modules.boto3_dynamodb.__virtual__()[source]

Only load if boto3 is available.

saltext.boto3.modules.boto3_dynamodb.list_tags_of_resource(resource_arn, region=None, key=None, keyid=None, profile=None)[source]

Return a dictionary of all tags currently attached to the given resource.

resource_arn (str):

The ARN of the resource for which to list tags.

region (str, optional):

The AWS region where the resource is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt-call boto3_dynamodb.list_tags_of_resource
saltext.boto3.modules.boto3_dynamodb.tag_resource(resource_arn, tags, region=None, key=None, keyid=None, profile=None)[source]

Set the given tags (dict or list of {'Key':..., 'Value':...}) on the given resource.

resource_arn (str):

The ARN of the resource to tag.

tags (dict or list of dict):

The tags to set on the resource. Can be a dictionary of key-value pairs or a list of dictionaries with “Key” and “Value” keys.

region (str, optional):

The AWS region where the resource is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt-call boto3_dynamodb.tag_resource
saltext.boto3.modules.boto3_dynamodb.untag_resource(resource_arn, tag_keys, region=None, key=None, keyid=None, profile=None)[source]

Remove the given tag keys from the given resource.

CLI Example:

resource_arn (str):

The ARN of the resource from which to remove tags.

tag_keys (list of str):

The keys of the tags to remove from the resource.

region (str, optional):

The AWS region where the resource is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

salt-call boto3_dynamodb.untag_resource
saltext.boto3.modules.boto3_dynamodb.exists(table_name, region=None, key=None, keyid=None, profile=None)[source]

Check whether the given DynamoDB table exists.

table_name (str):

The name of the DynamoDB table to check for existence.

region (str, optional):

The AWS region where the table is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt-call boto3_dynamodb.exists
saltext.boto3.modules.boto3_dynamodb.describe(table_name, region=None, key=None, keyid=None, profile=None)[source]

Describe a DynamoDB table.

table_name (str):

The name of the DynamoDB table to describe.

region (str, optional):

The AWS region where the table is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt-call boto3_dynamodb.describe
saltext.boto3.modules.boto3_dynamodb.create_table(table_name, region=None, key=None, keyid=None, profile=None, read_capacity_units=None, write_capacity_units=None, hash_key=None, hash_key_data_type=None, range_key=None, range_key_data_type=None, local_indexes=None, global_indexes=None)[source]

Create a DynamoDB table.

table_name (str):

The name of the DynamoDB table to create.

region (str, optional):

The AWS region where the table will be created.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

read_capacity_units (int, optional):

The provisioned read capacity units for the table.

write_capacity_units (int, optional):

The provisioned write capacity units for the table.

hash_key (str):

The name of the hash key (partition key) for the table.

hash_key_data_type (str):

The data type of the hash key (e.g., “S” for string, “N” for number).

range_key (str, optional):

The name of the range key (sort key) for the table.

range_key_data_type (str, optional):

The data type of the range key (e.g., “S” for string, “N” for number).

local_indexes (list, optional):

A list of local secondary index definitions.

global_indexes (list, optional):

A list of global secondary index definitions.

CLI Example:

salt-call boto3_dynamodb.create_table
saltext.boto3.modules.boto3_dynamodb.delete(table_name, region=None, key=None, keyid=None, profile=None)[source]

Delete a DynamoDB table.

table_name (str):

The name of the DynamoDB table to delete.

region (str, optional):

The AWS region where the table is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt-call boto3_dynamodb.delete
saltext.boto3.modules.boto3_dynamodb.update(table_name, throughput=None, global_indexes=None, region=None, key=None, keyid=None, profile=None)[source]

Update the provisioned throughput or global secondary indexes of a table.

throughput (dict, optional):

A dict with keys read and write specifying the provisioned throughput.

global_indexes (list, optional):

A list of GlobalSecondaryIndexUpdates entries (passed through to the boto3 API).

region (str, optional):

The AWS region where the table is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt-call boto3_dynamodb.update
saltext.boto3.modules.boto3_dynamodb.create_global_secondary_index(table_name, global_index, region=None, key=None, keyid=None, profile=None)[source]

Create a single global secondary index. global_index is an AWS-format dict with IndexName, KeySchema, Projection, ProvisionedThroughput (as returned by extract_index()).

table_name (str):

The name of the DynamoDB table to which the global secondary index will be added.

global_index (dict):

An AWS-format dict defining the global secondary index, including IndexName, KeySchema, Projection, and ProvisionedThroughput.

region (str, optional):

The AWS region where the table is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt-call boto3_dynamodb.create_global_secondary_index
saltext.boto3.modules.boto3_dynamodb.update_global_secondary_index(table_name, global_indexes, region=None, key=None, keyid=None, profile=None)[source]

Update the provisioned throughput of the given global secondary indexes.

table_name (str):

The name of the DynamoDB table containing the global secondary indexes to update.

global_indexes (dict, optional):

A dict mapping index names to {'read': R, 'write': W} specifying the new provisioned throughput for each global secondary index.

region (str, optional):

The AWS region where the table is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt-call boto3_dynamodb.update_global_secondary_index
saltext.boto3.modules.boto3_dynamodb.extract_index(index_data, global_index=False)[source]

Parse a legacy-style index specification (dict or list of OrderedDicts, keyed by an outer index key with a list of single-key dicts) and return an AWS API-shape dict suitable for the DynamoDB create_table or update_table calls.

index_data (dict):

The legacy-style index specification to parse.

global_index (bool, optional):

Whether the index is a global secondary index. Defaults to False.

CLI Example:

salt-call boto3_dynamodb.extract_index