Stacktape
Stacktape


DynamoDB Table

This example shows a basic dynamo db table configuration.

DynamoDb resource

  • Fully managed, serverless, highly-available and massively scalable key-value datastore.

Basic example

resources:
myDynamoDbTable:
type: dynamo-db-table
properties:
# Configures primary key for the table
#
# - Primary key uniquely identifies each item in the table
# - Two different kinds of primary keys are supported:
# - **simple primary key** - you only specify `partitionKey`
# - **composite primary key** - you specify both `partitionKey` and `sortKey`
# - Primary key specification cannot be modified during updates (after the table is created).
# - The attribute must be top-level (not nested) field.
# - Each document saved to the table must contain the primary key attribute(s).
# - To learn more about primary keys, refer to
# [AWS docs](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.CoreComponents.html#HowItWorks.CoreComponents.PrimaryKey)
#
# - Type: object
# - Required: true
primaryKey:
# Specifies a single top-level attribute (from schema attributes) which must be included in each table item.
#
# - If a table that has only `partitionKey` and no `sortKey`, no two items can have the same `partitionKey`.
# - Internally, DynamoDB uses the `partitionKey`'s value as an input to an internal hash function. The output from
# the hash function determines the partition (physical location) where the item is stored.
#
# - Type: object
# - Required: true
partitionKey:
# Name of the attribute that will be used as a key
#
# - Type: string
# - Required: true
name: example-name
# Type of the attribute that will be used as a key
#
# - Type: enum: [binary, number, string]
# - Required: true
# - Allowed values: [binary, number, string]
type: binary
# If specified, this attribute (chosen from schema attributes) becomes part of the composite primary key together with `partitionKey`
#
# - Using a `sortKey` in the primary key gives you additional flexibility when querying data.
# - In a table that has a `partitionKey` and a `sortKey`, it's possible for two items to have the
# same `partitionKey` value. However, those two items must have different `sortKey` values.
# - All items with the same `partitionKey` are stored together in the same partition in sorted
# order by `sortKey` value.
#
# - Type: object
# - Required: false
sortKey:
# Name of the attribute that will be used as a key
#
# - Type: string
# - Required: true
name: example-name
# Type of the attribute that will be used as a key
#
# - Type: enum: [binary, number, string]
# - Required: true
# - Allowed values: [binary, number, string]
type: binary
# Configures read and write throughput capabilities of the table
#
# - When you specify `provisionedThroughput`, the table will run in the **provisioned** mode and you need to specify read and write throughput for your table.
# - This can give you cost predictability and lower costs, but your table might not be able to handle an unpredictable load.
# - If `provisionedThroughput` is not configured, the table runs and is billed in an **on-demand** mode.
# This means you are only paying for what you use.
# - To learn more about differences between **provisioned** and **on-demand** modes, refer to
# [AWS docs](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadWriteCapacityMode.html)
#
# - Type: object
# - Required: false
provisionedThroughput:
# Number of read units available every second
#
# - Each read unit represent either:
# - one strongly consistent read
# - two eventually consistent reads
# - If exceeded, you receive a `ThrottlingException`.
# - The above applies for an item of up to 4 KB in size. If you need to read an item that is
# larger than 4 KB, additional read capacity units are consumed.
#
# - Type: number
# - Required: true
readUnits: 100
# Number of write units available every second
#
# - One write unit represents one write per second for an item of up to 1 KB in size.
# - If exceeded, you receive a `ThrottlingException`.
# - If you need to write an item that is larger than 1 KB, additional write capacity units are consumed.
#
# - Type: number
# - Required: true
writeUnits: 100
# Auto scaling configuration for write units
#
# - Even in provisioned mode, you can configure throughput scaling based on load.
# - The table throughput scales up or down once the specified thresholds are met.
# - Compared to **on-demand** mode (default, if you don't specify `provisionedThroughput`), you have more control
# of how your table will scale and can save costs. However, your table might not be able to scale enough for an unpredictable load.
# - To learn more, refer to
# [this detailed AWS article](https://aws.amazon.com/blogs/database/amazon-dynamodb-auto-scaling-performance-and-cost-optimization-at-any-scale/)
#
# - Type: object
# - Required: false
writeScaling:
# Minimum number of provisioned write units (per second) available
#
# Available write units will never scale down below this threshold
#
# - Type: number
# - Required: true
minUnits: 100
# Maximum number of provisioned write units (per second) table can scale up to
#
# Available write units will never scale up above the defined threshold
#
# - Type: number
# - Required: true
maxUnits: 100
# Percentual utilization threshold for scaling
#
# - If the table's consumed write capacity exceeds your target utilization (or falls below the target)
# for a sustained amount of time, the provisioned capacity is increased (decreased).
#
# - Type: number
# - Required: true
keepUtilizationUnder: 100
# Auto scaling configuration for read units
#
# - Even in provisioned mode, you can configure throughput scaling based on load.
# - The table throughput scales up or down once the specified thresholds are met.
# - Compared to **on-demand** mode (default, if you don't specify `provisionedThroughput`), you have more control
# of how your table will scale and can save costs. However, your table might not be able to scale enough for an unpredictable load.
# - To learn more, refer to
# [this detailed AWS article](https://aws.amazon.com/blogs/database/amazon-dynamodb-auto-scaling-performance-and-cost-optimization-at-any-scale/)
#
# - Type: object
# - Required: false
readScaling:
# Minimum number of provisioned read units (per second) available.
#
# - Available read units will never scale down below this threshold
#
# - Type: number
# - Required: true
minUnits: 100
# Maximum number of provisioned read units (per second) table can scale up to
#
# - Available read units will never scale up above the defined threshold
#
# - Type: number
# - Required: true
maxUnits: 100
# Percentual utilization threshold for scaling
#
# - If the table's consumed read capacity exceeds your target utilization (or falls below the target)
# for a sustained amount of time, the provisioned capacity is increased (decreased).
#
# - Type: number
# - Required: true
keepUtilizationUnder: 100
# Enables continuous backups with point-in-time recovery capability.
#
# - Point-in-time recovery enables you to restore table to any point in time during the last 35 days
# - The point-in-time recovery process always restores the data to a new table. You can restore data to the same table.
# - Enabling point-in-time recovery can result in additional charges. To learn more, refer to
# [AWS DynamoDB pricing](https://aws.amazon.com/dynamodb/pricing/on-demand/#DynamoDB_detailed_feature_pricing)
#
# - Type: boolean
# - Required: false
enablePointInTimeRecovery: true
# Enables streaming of table item changes and configures the stream type
#
# - Stream type determines what information is written to the stream for this table when the item in the table is modified.
# - Streams can be consumed by [functions](https://docs.stacktape.com/compute-resources/lambda-functions/#dynamo-db-stream-event)
# and [batch jobs](https://docs.stacktape.com/compute-resources/batch-jobs/#dynamo-db-event).
# - Allowed values are:
# - **KEYS_ONLY** - Only the key attributes of the modified item are written to the stream.
# - **NEW_IMAGE** - The entire item, as it appears after it was modified, is written to the stream.
# - **OLD_IMAGE** - The entire item, as it appeared before it was modified, is written to the stream.
# - **NEW_AND_OLD_IMAGES** - Both the new and the old item images of the item are written to the stream.
#
# - Type: enum: [KEYS_ONLY, NEW_AND_OLD_IMAGES, NEW_IMAGE, OLD_IMAGE]
# - Required: false
# - Allowed values: [KEYS_ONLY, NEW_AND_OLD_IMAGES, NEW_IMAGE, OLD_IMAGE]
streamType: KEYS_ONLY
# List of global secondary indexes used on this table
#
# - By default when querying items in Dynamo DB table, you can only query based on primary key attributes.
# - Some applications might need to perform queries, using a variety of different attributes as query criteria.
# To support these requirements efficiently, you can create one or more global secondary indexes.
# - To learn more about secondary indexes refer to [AWS docs](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GSI.html)
#
# - Type: array<object (reference)>
# - Required: false
secondaryIndexes:
- name: example-name

Contents

  •  Basic example