TableItem class
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
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleTable = new aws.dynamodb.Table("example", {
attributes: [{
name: "exampleHashKey",
type: "S",
}],
name: "example-name",
readCapacity: 10,
writeCapacity: 10,
hashKey: "exampleHashKey",
});
const example = new aws.dynamodb.TableItem("example", {
tableName: exampleTable.name,
hashKey: exampleTable.hashKey,
item: `{
\\"exampleHashKey\\": {\\"S\\": \\"something\\"},
\\"one\\": {\\"N\\": \\"11111\\"},
\\"two\\": {\\"N\\": \\"22222\\"},
\\"three\\": {\\"N\\": \\"33333\\"},
\\"four\\": {\\"N\\": \\"44444\\"}
}
`,
});
import pulumi
import pulumi_aws as aws
example_table = aws.dynamodb.Table("example",
attributes=[{
"name": "exampleHashKey",
"type": "S",
}],
name="example-name",
read_capacity=10,
write_capacity=10,
hash_key="exampleHashKey")
example = aws.dynamodb.TableItem("example",
table_name=example_table.name,
hash_key=example_table.hash_key,
item="""{
\"exampleHashKey\": {\"S\": \"something\"},
\"one\": {\"N\": \"11111\"},
\"two\": {\"N\": \"22222\"},
\"three\": {\"N\": \"33333\"},
\"four\": {\"N\": \"44444\"}
}
""")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var exampleTable = new Aws.DynamoDB.Table("example", new()
{
Attributes = new[]
{
new Aws.DynamoDB.Inputs.TableAttributeArgs
{
Name = "exampleHashKey",
Type = "S",
},
},
Name = "example-name",
ReadCapacity = 10,
WriteCapacity = 10,
HashKey = "exampleHashKey",
});
var example = new Aws.DynamoDB.TableItem("example", new()
{
TableName = exampleTable.Name,
HashKey = exampleTable.HashKey,
Item = @"{
\""exampleHashKey\"": {\""S\"": \""something\""},
\""one\"": {\""N\"": \""11111\""},
\""two\"": {\""N\"": \""22222\""},
\""three\"": {\""N\"": \""33333\""},
\""four\"": {\""N\"": \""44444\""}
}
",
});
});
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 {
exampleTable, err := dynamodb.NewTable(ctx, "example", &dynamodb.TableArgs{
Attributes: dynamodb.TableAttributeArray{
&dynamodb.TableAttributeArgs{
Name: pulumi.String("exampleHashKey"),
Type: pulumi.String("S"),
},
},
Name: pulumi.String("example-name"),
ReadCapacity: pulumi.Int(10),
WriteCapacity: pulumi.Int(10),
HashKey: pulumi.String("exampleHashKey"),
})
if err != nil {
return err
}
_, err = dynamodb.NewTableItem(ctx, "example", &dynamodb.TableItemArgs{
TableName: exampleTable.Name,
HashKey: exampleTable.HashKey,
Item: pulumi.String(`{
\"exampleHashKey\": {\"S\": \"something\"},
\"one\": {\"N\": \"11111\"},
\"two\": {\"N\": \"22222\"},
\"three\": {\"N\": \"33333\"},
\"four\": {\"N\": \"44444\"}
}
`),
})
if err != nil {
return err
}
return nil
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_dynamodb_tableitem" "example" {
table_name = aws_dynamodb_table.example.name
hash_key = aws_dynamodb_table.example.hash_key
item = "{\n \\\"exampleHashKey\\\": {\\\"S\\\": \\\"something\\\"},\n \\\"one\\\": {\\\"N\\\": \\\"11111\\\"},\n \\\"two\\\": {\\\"N\\\": \\\"22222\\\"},\n \\\"three\\\": {\\\"N\\\": \\\"33333\\\"},\n \\\"four\\\": {\\\"N\\\": \\\"44444\\\"}\n}\n"
}
resource "aws_dynamodb_table" "example" {
attributes {
name = "exampleHashKey"
type = "S"
}
name = "example-name"
read_capacity = 10
write_capacity = 10
hash_key = "exampleHashKey"
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.dynamodb.Table;
import com.pulumi.aws.dynamodb.TableArgs;
import com.pulumi.aws.dynamodb.inputs.TableAttributeArgs;
import com.pulumi.aws.dynamodb.TableItem;
import com.pulumi.aws.dynamodb.TableItemArgs;
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) {
var exampleTable = new Table("exampleTable", TableArgs.builder()
.attributes(TableAttributeArgs.builder()
.name("exampleHashKey")
.type("S")
.build())
.name("example-name")
.readCapacity(10)
.writeCapacity(10)
.hashKey("exampleHashKey")
.build());
var example = new TableItem("example", TableItemArgs.builder()
.tableName(exampleTable.name())
.hashKey(exampleTable.hashKey())
.item("""
{
\"exampleHashKey\": {\"S\": \"something\"},
\"one\": {\"N\": \"11111\"},
\"two\": {\"N\": \"22222\"},
\"three\": {\"N\": \"33333\"},
\"four\": {\"N\": \"44444\"}
}
""")
.build());
}
}
resources:
example:
type: aws:dynamodb:TableItem
properties:
tableName: ${exampleTable.name}
hashKey: ${exampleTable.hashKey}
item: |
{
\"exampleHashKey\": {\"S\": \"something\"},
\"one\": {\"N\": \"11111\"},
\"two\": {\"N\": \"22222\"},
\"three\": {\"N\": \"33333\"},
\"four\": {\"N\": \"44444\"}
}
exampleTable:
type: aws:dynamodb:Table
name: example
properties:
attributes:
- name: exampleHashKey
type: S
name: example-name
readCapacity: 10
writeCapacity: 10
hashKey: exampleHashKey
Import
Identity Schema
Required
tableName(String) Name of the DynamoDB table.hashKeyValue(String) Canonical value of the hash key (base64 forB, verbatim forNandS).
Optional
rangeKeyValue(String) Canonical value of the range key, required for tables that define a range key.accountId(String) AWS Account where this resource is managed.region(String) Region where this resource is managed.
For tables with a range key, append the range key value:
Use pulumi import for the same effect on the command line:
$ pulumi import aws:dynamodb/tableItem:TableItem example example-name,something
> Note: Importing requires dynamodb:DescribeTable in addition to dynamodb:GetItem. The DescribeTable call is used to recover the key attribute names and types from the table's schema.
> Note: If a hash key or range key value contains the separator character (,), use the import block with the identity attribute. The legacy pulumi import command and id-based import block cannot disambiguate separators from value content.
For Binary (B) key attributes, the value in the import ID and the identity attribute must be standard base64.
Constructors
- TableItem(String name, {TableItemArgs? args, CustomResourceOptions? options})
-
Creates a new TableItem.
nameThe Pulumi resource name.argsArguments used to configure this TableItem. The set of arguments for TableItem.optionsResource options controlling this resource's behavior. - TableItem.reference(String urn)
- Creates a typed reference to an existing TableItem resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
hashKey
↔ Output<
String> -
Hash key to use for lookups and identification of the item
latefinal
-
hashKeyValue
↔ Output<
String> -
Canonical string representation of the hash key value. Binary values are base64-encoded; numbers and strings are taken verbatim.
latefinal
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
item
↔ Output<
String> -
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.
latefinal
-
rangeKey
↔ Output<
String?> -
Range key to use for lookups and identification of the item. Required if there is range key defined in the table.
latefinal
-
rangeKeyValue
↔ Output<
String> -
Canonical string representation of the range key value, when the table has a range key. Same encoding as
hashKeyValue.latefinal -
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
tableName
↔ Output<
String> -
Name or ARN of the table to contain the item.
latefinal
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited