TableItem
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
using Pulumi;
using Aws = Pulumi.Aws;
class MyStack : Stack
{
public MyStack()
{
var exampleTable = new Aws.DynamoDB.Table("exampleTable", new Aws.DynamoDB.TableArgs
{
Attributes =
{
new Aws.DynamoDB.Inputs.TableAttributeArgs
{
Name = "exampleHashKey",
Type = "S",
},
},
HashKey = "exampleHashKey",
ReadCapacity = 10,
WriteCapacity = 10,
});
var exampleTableItem = new Aws.DynamoDB.TableItem("exampleTableItem", new Aws.DynamoDB.TableItemArgs
{
HashKey = exampleTable.HashKey,
Item = @"{
""exampleHashKey"": {""S"": ""something""},
""one"": {""N"": ""11111""},
""two"": {""N"": ""22222""},
""three"": {""N"": ""33333""},
""four"": {""N"": ""44444""}
}
",
TableName = exampleTable.Name,
});
}
}
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v2/go/aws/dynamodb"
"github.com/pulumi/pulumi/sdk/v2/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
exampleTable, err := dynamodb.NewTable(ctx, "exampleTable", &dynamodb.TableArgs{
Attributes: dynamodb.TableAttributeArray{
&dynamodb.TableAttributeArgs{
Name: pulumi.String("exampleHashKey"),
Type: pulumi.String("S"),
},
},
HashKey: pulumi.String("exampleHashKey"),
ReadCapacity: pulumi.Int(10),
WriteCapacity: pulumi.Int(10),
})
if err != nil {
return err
}
_, err = dynamodb.NewTableItem(ctx, "exampleTableItem", &dynamodb.TableItemArgs{
HashKey: exampleTable.HashKey,
Item: pulumi.String(fmt.Sprintf("%v%v%v%v%v%v%v%v", "{\n", " \"exampleHashKey\": {\"S\": \"something\"},\n", " \"one\": {\"N\": \"11111\"},\n", " \"two\": {\"N\": \"22222\"},\n", " \"three\": {\"N\": \"33333\"},\n", " \"four\": {\"N\": \"44444\"}\n", "}\n", "\n")),
TableName: exampleTable.Name,
})
if err != nil {
return err
}
return nil
})
}import pulumi
import pulumi_aws as aws
example_table = aws.dynamodb.Table("exampleTable",
attributes=[{
"name": "exampleHashKey",
"type": "S",
}],
hash_key="exampleHashKey",
read_capacity=10,
write_capacity=10)
example_table_item = aws.dynamodb.TableItem("exampleTableItem",
hash_key=example_table.hash_key,
item="""{
"exampleHashKey": {"S": "something"},
"one": {"N": "11111"},
"two": {"N": "22222"},
"three": {"N": "33333"},
"four": {"N": "44444"}
}
""",
table_name=example_table.name)import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const exampleTable = new aws.dynamodb.Table("example", {
attributes: [{
name: "exampleHashKey",
type: "S",
}],
hashKey: "exampleHashKey",
readCapacity: 10,
writeCapacity: 10,
});
const exampleTableItem = new aws.dynamodb.TableItem("example", {
hashKey: exampleTable.hashKey,
item: `{
"exampleHashKey": {"S": "something"},
"one": {"N": "11111"},
"two": {"N": "22222"},
"three": {"N": "33333"},
"four": {"N": "44444"}
}
`,
tableName: exampleTable.name,
});Create a TableItem Resource
new TableItem(name: string, args: TableItemArgs, opts?: CustomResourceOptions);def TableItem(resource_name, opts=None, hash_key=None, item=None, range_key=None, table_name=None, __props__=None);func NewTableItem(ctx *Context, name string, args TableItemArgs, opts ...ResourceOption) (*TableItem, error)public TableItem(string name, TableItemArgs args, CustomResourceOptions? opts = null)- name string
- The unique name of the resource.
- args TableItemArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- opts ResourceOptions
- A bag of options that control this resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args TableItemArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args TableItemArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
TableItem Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.
Inputs
The TableItem resource accepts the following input properties:
- Hash
Key string Hash key to use for lookups and identification of the item
- Item 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.
- Table
Name string The name of the table to contain the item.
- Range
Key string Range key to use for lookups and identification of the item. Required if there is range key defined in the table.
- Hash
Key string Hash key to use for lookups and identification of the item
- Item 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.
- Table
Name string The name of the table to contain the item.
- Range
Key string Range key to use for lookups and identification of the item. Required if there is range key defined in the table.
- hash
Key string Hash key to use for lookups and identification of the item
- item 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.
- table
Name string The name of the table to contain the item.
- range
Key string Range key to use for lookups and identification of the item. Required if there is range key defined in the table.
- hash_
key str Hash key to use for lookups and identification of the item
- item str
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.
- table_
name str The name of the table to contain the item.
- range_
key str Range key to use for lookups and identification of the item. Required if there is range key defined in the table.
Outputs
All input properties are implicitly available as output properties. Additionally, the TableItem resource produces the following output properties:
Look up an Existing TableItem Resource
Get an existing TableItem resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: TableItemState, opts?: CustomResourceOptions): TableItemstatic get(resource_name, id, opts=None, hash_key=None, item=None, range_key=None, table_name=None, __props__=None);func GetTableItem(ctx *Context, name string, id IDInput, state *TableItemState, opts ...ResourceOption) (*TableItem, error)public static TableItem Get(string name, Input<string> id, TableItemState? state, CustomResourceOptions? opts = null)- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
The following state arguments are supported:
- Hash
Key string Hash key to use for lookups and identification of the item
- Item 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.
- Range
Key string Range key to use for lookups and identification of the item. Required if there is range key defined in the table.
- Table
Name string The name of the table to contain the item.
- Hash
Key string Hash key to use for lookups and identification of the item
- Item 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.
- Range
Key string Range key to use for lookups and identification of the item. Required if there is range key defined in the table.
- Table
Name string The name of the table to contain the item.
- hash
Key string Hash key to use for lookups and identification of the item
- item 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.
- range
Key string Range key to use for lookups and identification of the item. Required if there is range key defined in the table.
- table
Name string The name of the table to contain the item.
- hash_
key str Hash key to use for lookups and identification of the item
- item str
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.
- range_
key str Range key to use for lookups and identification of the item. Required if there is range key defined in the table.
- table_
name str The name of the table to contain the item.
Package Details
- Repository
- https://github.com/pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
awsTerraform Provider.