Skip to content

Data Source: awsDynamodbTableItem

Terraform data source for retrieving a value from an AWS DynamoDB table.

Example Usage

Basic 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";
new aws.dataAwsDynamodbTableItem.DataAwsDynamodbTableItem(this, "test", {
  depends_on: ["${aws_dynamodb_table_item.example}"],
  expressionAttributeNames: {
    "#P": "Percentile",
  },
  key: '{\n\t"hashKey": {"S": "example"}\n}\n',
  projectionExpression: "#P",
  tableName: "${aws_dynamodb_table.example.name}",
});

Argument Reference

The following arguments are required:

  • tableName - (Required) The name of the table containing the requested item.
  • key - (Required) A map of attribute names to AttributeValue objects, representing the primary key of the item to retrieve. For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.

The following arguments are optional:

  • expressionAttributeName - (Optional) - One or more substitution tokens for attribute names in an expression. Use the # character in an expression to dereference an attribute name.
  • projectionExpression - (Optional) A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas. If no attribute names are specified, then all attributes are returned. If any of the requested attributes are not found, they do not appear in the result.

Attributes Reference

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

  • item - A map of attribute names to AttributeValue objects, as specified by ProjectionExpression.