table#

hub.exec.boto3.client.dynamodb.create_table hub.exec.boto3.client.dynamodb.delete_table hub.exec.boto3.client.dynamodb.describe_table hub.exec.boto3.client.dynamodb.list_tables hub.exec.boto3.client.dynamodb.update_table resource = await hub.tool.boto3.resource.create(ctx, “dynamodb”, “Table”, name) hub.tool.boto3.resource.exec(resource, delete, *args, **kwargs) hub.tool.boto3.resource.exec(resource, delete_item, *args, **kwargs) hub.tool.boto3.resource.exec(resource, get_item, *args, **kwargs) hub.tool.boto3.resource.exec(resource, put_item, *args, **kwargs) hub.tool.boto3.resource.exec(resource, query, *args, **kwargs) hub.tool.boto3.resource.exec(resource, scan, *args, **kwargs) hub.tool.boto3.resource.exec(resource, update, *args, **kwargs) hub.tool.boto3.resource.exec(resource, update_item, *args, **kwargs)

async idem_aws.states.aws.dynamodb.table.present(hub, ctx, name: str, attribute_definitions: List[AttributeDefinition], key_schema: List[KeySchemaElement], resource_id: str = None, billing_mode: str = None, global_secondary_indexes: List[GlobalSecondaryIndex] = None, local_secondary_indexes: List[LocalSecondaryIndex] = None, point_in_time_recovery: PointInTimeRecovery = None, provisioned_throughput: ProvisionedThroughput = None, replica_updates: List = None, sse_specification: SSESpecification = None, stream_specification: StreamSpecification = None, table_class: str = None, tags: Dict[str, Any] = None, time_to_live: TimeToLive = None, timeout: Timeout = None) Dict[str, Any][source]#

The CreateTable operation adds a new table to your account.

In an Amazon Web Services account, table names must be unique within each Region. That is, you can have two tables with same name if you create the tables in different Regions. CreateTable is an asynchronous operation. Upon receiving a CreateTable request, DynamoDB immediately returns a response with a TableStatus of CREATING. After the table is created, DynamoDB sets the TableStatus to ACTIVE. You can perform read and write operations only on an ACTIVE table. You can Optionally define secondary indexes on the new table, as part of the CreateTable operation. If you want to create multiple tables with secondary indexes on them, you must create the tables sequentially. Only one table with secondary indexes can be in the CREATING state at any given time. You can use the DescribeTable action to check the table status.

Parameters:
  • name (str) – A name of the table to create.

  • resource_id (str, Optional) – The name of the Dynamodb table.

  • attribute_definitions (list[dict[str, Any]]) –

    An array of attributes that describe the key schema for the table and indexes.

    • AttributeName (str):

      A name for the attribute.

    • AttributeType (str):
      The data type for the attribute, where:

      S - the attribute is of type String N - the attribute is of type Number B - the attribute is of type Binary

  • key_schema (list[dict[str, Any]]) –

    Specifies the attributes that make up the primary key for a table or an index. The attributes in KeySchema must also be defined in the AttributeDefinitions array. For more information, see Data Model in the Amazon DynamoDB Developer Guide.

    Each KeySchemaElement in the array is composed of:

    • AttributeName - The name of this key attribute.

    • KeyType - The role that the key attribute will assume:
      • HASH - partition key

      • RANGE - sort key

    The partition key of an item is also known as its hash attribute. The term “hash attribute” derives from the DynamoDB usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values. The sort key of an item is also known as its range attribute. The term “range attribute” derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value. For a simple primary key (partition key), you must provide exactly one element with a KeyType of HASH. For a composite primary key (partition key and sort key), you must provide exactly two elements, in this order: The first element must have a KeyType of HASH, and the second element must have a KeyType of RANGE. For more information, see Working with Tables in the Amazon DynamoDB Developer Guide.

    • AttributeName (str):

      The name of a key attribute.

    • KeyType (str):
      The role that this key attribute will assume:
      • HASH - partition key

      • RANGE - sort key

      The partition key of an item is also known as its hash attribute. The term “hash attribute” derives from DynamoDB’s usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values. The sort key of an item is also known as its range attribute. The term “range attribute” derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.

  • billing_mode (str, Optional) –

    Controls how users are charged for read and write throughput and how they manage capacity.

    • PROVISIONED - AWS recommends using PROVISIONED for predictable workloads. PROVISIONED sets the billing

      mode to Provisioned Mode.

    • PAY_PER_REQUEST - AWS recommends using PAY_PER_REQUEST for unpredictable workloads. PAY_PER_REQUEST

      sets the billing mode to On-Demand Mode .

  • global_secondary_indexes (list, Optional) –

    One or more global secondary indexes (the maximum is 20) to be created on the table.

    • IndexName (str):

      The name of the global secondary index. The name must be unique among all other indexes on this table.

    • KeySchema (list[dict[str, Any]]): The complete key schema for a global secondary index.

      • AttributeName (str):

        The name of a key attribute.

      • KeyType (str):
        The role that this key attribute will assume:
        • HASH - partition key

        • RANGE - sort key

        The partition key of an item is also known as its hash attribute. The term “hash attribute” derives from DynamoDB’s usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values. The sort key of an item is also known as its range attribute. The term “range attribute” derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.

    • Projection (dict[str, Any]):

      Represents attributes that are copied (projected) from the table into the global secondary index. These are in addition to the primary key attributes and index key attributes, which are automatically projected.

      • ProjectionType (str, Optional):
        The set of attributes that are projected into the index:

        KEYS_ONLY - Only the index and primary keys are projected into the index. INCLUDE - In addition to the attributes described in KEYS_ONLY, the secondary index will include other non-key attributes that you specify. ALL - All of the table attributes are projected into the index.

    • ProvisionedThroughput (dict[str, Any], Optional):

      Represents the provisioned throughput settings for the specified global secondary index. For current minimum and maximum provisioned throughput values, see Service, Account, and Table Quotas in the Amazon DynamoDB Developer Guide.

      • ReadCapacityUnits (int):

        The maximum number of strongly consistent reads consumed per second before DynamoDB returns a ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide. If read/write capacity mode is PAY_PER_REQUEST the value is set to 0.

      • WriteCapacityUnits (int):

        The maximum number of writes consumed per second before DynamoDB returns a ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide. If read/write capacity mode is PAY_PER_REQUEST the value is set to 0.

  • local_secondary_indexes (list[dict[str, Any]], Optional) –

    One or more local secondary indexes (the maximum is 5) to be created on the table. Each index is scoped to a given partition key value. There is a 10 GB size limit per partition key value; otherwise, the size of a local secondary index is unconstrained.

    • IndexName (str):

      The name of the local secondary index. The name must be unique among all other indexes on this table.

    • KeySchema (list[dict[str, Any]]):

      The complete key schema for the local secondary index.

      • AttributeName (str):

        The name of a key attribute.

      • KeyType (str):
        The role that this key attribute will assume:

        HASH - partition key RANGE - sort key

        The partition key of an item is also known as its hash attribute. The term “hash attribute” derives from DynamoDB’s usage of an internal hash function to evenly distribute data items across partitions, based on their partition key values. The sort key of an item is also known as its range attribute. The term “range attribute” derives from the way DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.

    • Projection (dict[str, Any]):

      Represents attributes that are copied (projected) from the table into the local secondary index. These are in addition to the primary key attributes and index key attributes, which are automatically projected.

      • ProjectionType (str, Optional):
        The set of attributes that are projected into the index:

        KEYS_ONLY - Only the index and primary keys are projected into the index. INCLUDE - In addition to the attributes described in KEYS_ONLY, the secondary index will include other non-key attributes that you specify. ALL - All of the table attributes are projected into the index.

      • NonKeyAttributes (list[str], Optional): Represents the non-key attribute names which will be projected into the index. For local

        secondary indexes, the total count of NonKeyAttributes summed across all of the local secondary indexes, must not exceed 100. If you project the same attribute into two different indexes, this counts as two distinct attributes when determining the total.

  • point_in_time_recovery (dict, Optional) –

    The Point in time recovery settings for the specified table:

    • Enabled - Indicates whether the point in time recovery is enabled or not for the specified table.

  • provisioned_throughput (dict, Optional) –

    Represents the provisioned throughput settings for a specified table or index. The settings can be modified using the UpdateTable operation. If you set BillingMode as PROVISIONED, you must specify this property. If you set BillingMode as PAY_PER_REQUEST, you cannot specify this property. For current minimum and maximum provisioned throughput values, see Service, Account, and Table Quotas in the Amazon DynamoDB Developer Guide. Defaults to None.

    • (ReadCapacityUnits): The maximum number of strongly consistent reads consumed per second before DynamoDB returns a

      ThrottlingException. For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide. If read/write capacity mode is PAY_PER_REQUEST the value is set to 0.

    • (WriteCapacityUnits): The maximum number of writes consumed per second before DynamoDB returns a ThrottlingException.

      For more information, see Specifying Read and Write Requirements in the Amazon DynamoDB Developer Guide. If read/write capacity mode is PAY_PER_REQUEST the value is set to 0.

  • replica_updates (list, Optional) – A list of replica update actions (create, delete, or update) for the table.

  • sse_specification (dict[str, Any], Optional) –

    Represents the settings used to enable server-side encryption. Defaults to None.

    • Enabled (bool, Optional):

      Indicates whether server-side encryption is done using an Amazon Web Services managed key or an Amazon Web Services owned key. If enabled (true), server-side encryption type is set to KMS and an Amazon Web Services managed key is used (KMS charges apply). If disabled (false) or not specified, server-side encryption is set to Amazon Web Services owned key.

    • SSEType (str, Optional):

      Server-side encryption type. The only supported value is:

      KMS - Server-side encryption that uses Key Management Service. The key is stored in your account and is managed by KMS (KMS charges apply).

    • KMSMasterKeyId (str, Optional):

      The KMS key that should be used for the KMS encryption. To specify a key, use its key ID, Amazon Resource Name (ARN), alias name, or alias ARN. Note that you should only provide this parameter if the key is different from the default DynamoDB key alias/aws/dynamodb.

  • stream_specification (dict[str, Any], Optional) –

    The settings for DynamoDB Streams on the table. These settings consist of: StreamEnabled - Indicates whether DynamoDB Streams is to be enabled (true) or disabled (false). StreamViewType - When an item in the table is modified, StreamViewType determines what information is written to the table’s stream. Valid values for StreamViewType are:

    • KEYS_ONLY - Only the key attributes of the modified item are written to the stream.

    • NEW_IMAGE - The entire item, as it appears after it was modified, is written to the stream.

    • OLD_IMAGE - The entire item, as it appeared before it was modified, is written to the stream.

    • NEW_AND_OLD_IMAGES - Both the new and the old item images of the item are written to the stream. Defaults to None.

    • StreamEnabled (bool):

      Indicates whether DynamoDB Streams is enabled (true) or disabled (false) on the table.

    • StreamViewType (str, Optional):

      When an item in the table is modified, StreamViewType determines what information is written to the stream for this table. Valid values for StreamViewType are:

      • KEYS_ONLY - Only the key attributes of the modified item are written to the stream.

      • NEW_IMAGE - The entire item, as it appears after it was modified, is written to the stream.

      • OLD_IMAGE - The entire item, as it appeared before it was modified, is written to the stream.

      • NEW_AND_OLD_IMAGES - Both the new and the old item images of the item are written to the stream.

  • table_class (str, Optional) – The table class of the new table. Valid values are STANDARD and STANDARD_INFREQUENT_ACCESS.

  • tags (list or dict, Optional) –

    The tags to assign to the route_table. Defaults to None. Format can be [{“Key”: tag-key, “Value”: tag-value}] or dict {tag-key: tag-value}

    • Key (str): The key of the tag. Tag keys are case sensitive. Each DynamoDB table can only have up to one tag

      with the same key. If you try to add an existing tag (same key), the existing tag value will be updated to the new value.

    • Value (str): The value of the tag. Tag values are case-sensitive and can be null.

  • time_to_live (dict, Optional) –

    The Time to Live (TTL) settings for the specified table:

    • Enabled - Indicates whether the time to live is enabled or not for the specified table.

    • AttributeName - The name of the TTL attribute for items in the table.

  • timeout (dict, Optional) –

    Timeout configuration for create/update/deletion of AWS IAM Policy.

    • create (dict):

      Timeout configuration for creating AWS IAM Policy.

      • delay (int, Optional): The amount of time in seconds to wait between attempts.

      • max_attempts (int, Optional): Customized timeout configuration containing delay and max attempts.

    • update(dict, Optional):

      Timeout configuration for updating AWS IAM Policy.

      • delay (int, Optional): The amount of time in seconds to wait between attempts.

      • max_attempts: (int, Optional) Customized timeout configuration containing delay and max attempts.

Request Syntax:
[dynamodb_table-name]:
  aws.dynamodb.table.present:
    - name: 'string'
    - attribute_definitions: 'list'
    - key_schema: 'list'
    - resource_id: 'string'
    - billing_mode: 'string'
    - global_secondary_indexes: 'list'
    - local_secondary_indexes: 'list'
    - point_in_time_recovery: 'dict'
    - provisioned_throughput: 'dict'
    - replica_updates: 'list'
    - sse_specification: 'dict'
    - stream_specification: 'dict'
    - table_class: 'str'
    - tags:
      - Key: 'string'
        Value: 'string'
    - time_to_live: 'dict'
Returns:

Dict[str, Any]

Examples

test_dyanmodb_table:
  aws.dynamodb.table.present:
    - name: test_dyanmodb_table
    - resource_id: dyanmodb_table-1e8965drf2c56902g
    - attribute_definitions:
      - AttributeName: Artist
        AttributeType: S
      - AttributeName: SongTitle
        AttributeType: S
    - key_schema:
      - AttributeName: Artist
        AttributeType: HASH
      - AttributeName: SongTitle
        AttributeType: RANGE
    - provisioned_throughput = { "ReadCapacityUnits": 123, "WriteCapacityUnits": 123, }
    - tags:
      - Key: Name
        Value: test-nat-gateway
async idem_aws.states.aws.dynamodb.table.absent(hub, ctx, name: str, resource_id: str = None, timeout: Dict = None) Dict[str, Any][source]#

The DeleteTable operation deletes a table and all of its items.

After a DeleteTable request, the specified table is in the DELETING state until DynamoDB completes the deletion. If the table is in the ACTIVE state, you can delete it. If a table is in CREATING or UPDATING states, then DynamoDB returns a ResourceInUseException. If the specified table does not exist, DynamoDB returns a ResourceNotFoundException. If table is already in the DELETING state, no error is returned. DynamoDB might continue to accept data read and write operations, such as GetItem and PutItem, on a table in the DELETING state until the table deletion is complete. When you delete a table, any indexes on that table are also deleted. If you have DynamoDB Streams enabled on the table, then the corresponding stream on that table goes into the DISABLED state, and the stream is automatically deleted after 24 hours. Use the DescribeTable action to check the status of the table.

Parameters:
  • name (str) – The name of the Idem state.

  • resource_id (str, Optional) – The name of the Dynamodb table. Idem automatically considers this resource being absent if this field is not specified.

  • timeout (dict, Optional) –

    Timeout configuration for create/update/deletion of AWS DynamoDB Table.

    • delete (str):

      Timeout configuration for deletion of a DynamoDB Table.

      • delay – The amount of time in seconds to wait between attempts.

      • max_attempts – Customized timeout configuration containing delay and max attempts.

Request Syntax:
[test_dynamodb_table_absent]:
  aws.dynamodb.table.absent:
    - name: 'string'
    - resource_id: 'string'
Returns:

Dict[str, Any]

Examples

test_dynamodb_table_absent:
  aws.dynamodb.table.absent:
    - name: test_dynamodb_table
    - resource_id: test_dynamodb_table_name
async idem_aws.states.aws.dynamodb.table.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#

Describe the resource in a way that can be recreated/managed with the corresponding “present” function.

Returns:

Dict[str, Dict[str, Any]]

Examples

$ idem describe aws.dynamodb.table