Skip to content

Resource: awsDynamodbTableItem

Provides a DynamoDB table item resource

-> Note: This resource is not meant to be used for managing large amounts of data in your table, it is not designed to scale. You should perform regular backups of all data in the table, see AWS docs for more.

Example Usage

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsDynamodbTableExample = new aws.dynamodbTable.DynamodbTable(
  this,
  "example",
  {
    attribute: [
      {
        name: "exampleHashKey",
        type: "S",
      },
    ],
    hashKey: "exampleHashKey",
    name: "example-name",
    readCapacity: 10,
    writeCapacity: 10,
  }
);
const awsDynamodbTableItemExample = new aws.dynamodbTableItem.DynamodbTableItem(
  this,
  "example_1",
  {
    hashKey: awsDynamodbTableExample.hashKey,
    item: '{\n  "exampleHashKey": {"S": "something"},\n  "one": {"N": "11111"},\n  "two": {"N": "22222"},\n  "three": {"N": "33333"},\n  "four": {"N": "44444"}\n}\n',
    tableName: awsDynamodbTableExample.name,
  }
);
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsDynamodbTableItemExample.overrideLogicalId("example");

Argument Reference

\~> Note: Names included in item are represented internally with everything but letters removed. There is the possibility of collisions if two names, once filtered, are the same. For example, the names yourNameHere and yournamehere will overlap and cause an error.

The following arguments are supported:

  • hashKey - (Required) Hash key to use for lookups and identification of the item
  • item - (Required) JSON representation of a map of attribute name/value pairs, one for each attribute. Only the primary key attributes are required; you can optionally provide other attribute name-value pairs for the item.
  • rangeKey - (Optional) Range key to use for lookups and identification of the item. Required if there is range key defined in the table.
  • tableName - (Required) Name of the table to contain the item.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

Import

DynamoDB table items cannot be imported.