aws::dynamodb-table

Creates a DynamoDb table.

Example

aws::dynamodb-table dynamodb-table-example
    name: "dynamodb-table-example"
    hash-key: "HashKeyName"
    range-key: "RangeKeyName"
    billing-mode: "PROVISIONED"
    read-capacity: 5
    write-capacity: 5
    stream-enabled: true
    stream-view-type: "KEYS_ONLY"

    attribute
        name: "HashKeyName"
        type: "S"
    end

    attribute
        name: "RangeKeyName"
        type: "S"
    end

    attribute
        name: "GlobalRangeKeyName"
        type: "S"
    end

    attribute
        name: "LocalRangeKeyName"
        type: "S"
    end

    global-secondary-index
        name: "global-secondary-index"
        hash-key: "RangeKeyName"
        range-key: "GlobalRangeKeyName"
        write-capacity: 20
        read-capacity: 20
        projection-type: "INCLUDE"
        non-key-attributes: ["HashKeyName"]
    end

    local-secondary-index
        name: "local-secondary-index"
        range-key: "LocalRangeKeyName"
        projection-type: "ALL"
    end

    server-side-encryption
        enabled: true
    end

    tags: {
        Name: "dynamodb-table-example"
    }
end

Attributes

Attribute Description
attribute set subresource

Set of attribute definitions that describe the key schema. (Required)

name
The name for the attribute. (Required)
type
The data type for the attribute. Valid values are S, N or B. (Required)
hash-key The name of the hash (partition) key for this index. Must be defined as an attribute. (Required)
range-key The name of the range (sort) key for this index. Must be defined as an attribute.
name The name of the DynamoDb table. Valid values satisfy the regex: [[a-zA-Z0-9_.-]+]. (Required)
billing-mode Controls how you are charged for read and write throughput and how you manage capacity. Defaults to PROVISIONED. Valid values are PROVISIONED or PAY_PER_REQUEST.
global-secondary-index set subresource

One or more global secondary indexes to be created on the table.

name
The name for the index. (Required)
hash-key
The name of the hash (partition) key for this index. (Required)
range-key
The name of the range (sort) key for this index.
write-capacity
The maximum number of writes per second for this table before an exception is thrown. Required if billing-mode is set to PROVISIONED. Minimum allowed value is 1.
read-capacity
The maximum number of reads per second for this table before an exception is thrown. Required if billing-mode is set to PROVISIONED. Minimum allowed value is 1.
projection-type
The set of attributes that are projected into this index. Valid values are ALL, INCLUDE or KEYS_ONLY. (Required)
non-key-attributes list
Provides a list of attributes to project into the index. These do not need to be defined as attributes on the table. Required only when projection-type is set to INCLUDE.
local-secondary-index set subresource

One or more local secondary indexes to be created on the table. LSIs automatically use the same hash key of the table itself.

name
The name for the index. Valid values satisfy the regex: [[a-zA-Z0-9_.-]+]. (Required)
range-key
The name of the range (sort) key for this index. (Required)
projection-type
The set of attributes that are projected into this index. Valid values are ALL, INCLUDE or KEYS_ONLY. (Required)
non-key-attributes list
Provides a list of attributes to project into the index. These do not need to be defined as attributes on the table. Required only when projection-type is set to INCLUDE.
write-capacity The maximum number of writes per second for this table before an exception is thrown. Required if billing-mode is set to PROVISIONED. Minimum allowed value is 1.
read-capacity The maximum number of reads per second for this table before an exception is thrown. Required if billing-mode is set to PROVISIONED. Minimum allowed value is 1.
server-side-encryption subresource

Settings used to determine server side encryption.

enabled
Whether or not to enable server-side encryption using an AWS managed KMS customer master key. (Required)
kms-key
The AWS managed KMS customer master key to encrypt the DynamoDb table. Only provide this if the key is different from the default DynamoDB customer master key alias/aws/dynamodb.
stream-enabled Indicates whether streams should be enabled.
stream-view-type Determines what information is written to the stream when an item is modified. Valid values are NEW_IMAGE, OLD_IMAGE, NEW_AND_OLD_IMAGES or KEYS_ONLY.
tags map The tags for the DynamoDb table.

Outputs

Attribute Description
arn The ARN of the DynamoDb table.
stream-arn The ARN of the table stream.
stream-label A timestamp, in ISO 8601 format, for the table stream.