published on Tuesday, Jul 14, 2026 by Pulumi
published on Tuesday, Jul 14, 2026 by Pulumi
Data source for retrieving a value from an AWS DynamoDB table.
Example Usage
Basic Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = aws.dynamodb.getTableItem({
tableName: example.name,
expressionAttributeNames: {
"#P": "Percentile",
},
projectionExpression: "#P",
key: `{
\\t\\"hashKey\\": {\\"S\\": \\"example\\"}
}
`,
});
import pulumi
import pulumi_aws as aws
test = aws.dynamodb.get_table_item(table_name=example["name"],
expression_attribute_names={
"#P": "Percentile",
},
projection_expression="#P",
key="""{
\t\"hashKey\": {\"S\": \"example\"}
}
""")
package main
import (
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/dynamodb"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := dynamodb.LookupTableItem(ctx, &dynamodb.LookupTableItemArgs{
TableName: example.Name,
ExpressionAttributeNames: map[string]interface{}{
"#P": "Percentile",
},
ProjectionExpression: pulumi.StringRef("#P"),
Key: "{\n\\t\\\"hashKey\\\": {\\\"S\\\": \\\"example\\\"}\n}\n",
}, nil)
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = Aws.DynamoDB.GetTableItem.Invoke(new()
{
TableName = example.Name,
ExpressionAttributeNames =
{
{ "#P", "Percentile" },
},
ProjectionExpression = "#P",
Key = @"{
\t\""hashKey\"": {\""S\"": \""example\""}
}
",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.dynamodb.DynamodbFunctions;
import com.pulumi.aws.dynamodb.inputs.GetTableItemArgs;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
final var test = DynamodbFunctions.getTableItem(GetTableItemArgs.builder()
.tableName(example.name())
.expressionAttributeNames(Map.of("#P", "Percentile"))
.projectionExpression("#P")
.key("""
{
\t\"hashKey\": {\"S\": \"example\"}
}
""")
.build());
}
}
variables:
test:
fn::invoke:
function: aws:dynamodb:getTableItem
arguments:
tableName: ${example.name}
expressionAttributeNames:
'#P': Percentile
projectionExpression: '#P'
key: |
{
\t\"hashKey\": {\"S\": \"example\"}
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
data "aws_dynamodb_gettableitem" "test" {
table_name = example.name
expression_attribute_names = {
"#P" = "Percentile"
}
projection_expression = "#P"
key = "{\n\\t\\\"hashKey\\\": {\\\"S\\\": \\\"example\\\"}\n}\n"
}
Using getTableItem
Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.
function getTableItem(args: GetTableItemArgs, opts?: InvokeOptions): Promise<GetTableItemResult>
function getTableItemOutput(args: GetTableItemOutputArgs, opts?: InvokeOptions): Output<GetTableItemResult>def get_table_item(expression_attribute_names: Optional[Mapping[str, str]] = None,
key: Optional[str] = None,
projection_expression: Optional[str] = None,
region: Optional[str] = None,
table_name: Optional[str] = None,
opts: Optional[InvokeOptions] = None) -> GetTableItemResult
def get_table_item_output(expression_attribute_names: pulumi.Input[Optional[Mapping[str, pulumi.Input[str]]]] = None,
key: pulumi.Input[Optional[str]] = None,
projection_expression: pulumi.Input[Optional[str]] = None,
region: pulumi.Input[Optional[str]] = None,
table_name: pulumi.Input[Optional[str]] = None,
opts: Optional[InvokeOptions] = None) -> Output[GetTableItemResult]func LookupTableItem(ctx *Context, args *LookupTableItemArgs, opts ...InvokeOption) (*LookupTableItemResult, error)
func LookupTableItemOutput(ctx *Context, args *LookupTableItemOutputArgs, opts ...InvokeOption) LookupTableItemResultOutput> Note: This function is named LookupTableItem in the Go SDK.
public static class GetTableItem
{
public static Task<GetTableItemResult> InvokeAsync(GetTableItemArgs args, InvokeOptions? opts = null)
public static Output<GetTableItemResult> Invoke(GetTableItemInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetTableItemResult> getTableItem(GetTableItemArgs args, InvokeOptions options)
public static Output<GetTableItemResult> getTableItem(GetTableItemArgs args, InvokeOptions options)
fn::invoke:
function: aws:dynamodb/getTableItem:getTableItem
arguments:
# arguments dictionarydata "aws_dynamodb_gettableitem" "name" {
# arguments
}The following arguments are supported:
- Key string
- 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.
- Table
Name string Name or ARN of the table containing the requested item.
The following arguments are optional:
- Expression
Attribute Dictionary<string, string>Names - One or more substitution tokens for attribute names in an expression. Use the
#character in an expression to dereference an attribute name. - Projection
Expression string - 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.
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- Key string
- 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.
- Table
Name string Name or ARN of the table containing the requested item.
The following arguments are optional:
- Expression
Attribute map[string]stringNames - One or more substitution tokens for attribute names in an expression. Use the
#character in an expression to dereference an attribute name. - Projection
Expression string - 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.
- Region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- key string
- 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.
- table_
name string Name or ARN of the table containing the requested item.
The following arguments are optional:
- expression_
attribute_ map(string)names - One or more substitution tokens for attribute names in an expression. Use the
#character in an expression to dereference an attribute name. - projection_
expression string - 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.
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- key String
- 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.
- table
Name String Name or ARN of the table containing the requested item.
The following arguments are optional:
- expression
Attribute Map<String,String>Names - One or more substitution tokens for attribute names in an expression. Use the
#character in an expression to dereference an attribute name. - projection
Expression String - 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.
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- key string
- 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.
- table
Name string Name or ARN of the table containing the requested item.
The following arguments are optional:
- expression
Attribute {[key: string]: string}Names - One or more substitution tokens for attribute names in an expression. Use the
#character in an expression to dereference an attribute name. - projection
Expression string - 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.
- region string
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- key str
- 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.
- table_
name str Name or ARN of the table containing the requested item.
The following arguments are optional:
- expression_
attribute_ Mapping[str, str]names - One or more substitution tokens for attribute names in an expression. Use the
#character in an expression to dereference an attribute name. - projection_
expression str - 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.
- region str
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
- key String
- 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.
- table
Name String Name or ARN of the table containing the requested item.
The following arguments are optional:
- expression
Attribute Map<String>Names - One or more substitution tokens for attribute names in an expression. Use the
#character in an expression to dereference an attribute name. - projection
Expression String - 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.
- region String
- Region where this resource will be managed. Defaults to the Region set in the provider configuration.
getTableItem Result
The following output properties are available:
- Id string
- The provider-assigned unique ID for this managed resource.
- Item string
- JSON representation of a map of attribute names to AttributeValue objects, as specified by ProjectionExpression.
- Key string
- Region string
- Table
Name string - Expression
Attribute Dictionary<string, string>Names - Projection
Expression string
- Id string
- The provider-assigned unique ID for this managed resource.
- Item string
- JSON representation of a map of attribute names to AttributeValue objects, as specified by ProjectionExpression.
- Key string
- Region string
- Table
Name string - Expression
Attribute map[string]stringNames - Projection
Expression string
- id string
- The provider-assigned unique ID for this managed resource.
- item string
- JSON representation of a map of attribute names to AttributeValue objects, as specified by ProjectionExpression.
- key string
- region string
- table_
name string - expression_
attribute_ map(string)names - projection_
expression string
- id String
- The provider-assigned unique ID for this managed resource.
- item String
- JSON representation of a map of attribute names to AttributeValue objects, as specified by ProjectionExpression.
- key String
- region String
- table
Name String - expression
Attribute Map<String,String>Names - projection
Expression String
- id string
- The provider-assigned unique ID for this managed resource.
- item string
- JSON representation of a map of attribute names to AttributeValue objects, as specified by ProjectionExpression.
- key string
- region string
- table
Name string - expression
Attribute {[key: string]: string}Names - projection
Expression string
- id str
- The provider-assigned unique ID for this managed resource.
- item str
- JSON representation of a map of attribute names to AttributeValue objects, as specified by ProjectionExpression.
- key str
- region str
- table_
name str - expression_
attribute_ Mapping[str, str]names - projection_
expression str
- id String
- The provider-assigned unique ID for this managed resource.
- item String
- JSON representation of a map of attribute names to AttributeValue objects, as specified by ProjectionExpression.
- key String
- region String
- table
Name String - expression
Attribute Map<String>Names - projection
Expression String
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.
published on Tuesday, Jul 14, 2026 by Pulumi