DynamoDB tables
Table operations read and change DynamoDB tables. They also accept the common keys.
A request with Delete table or Truncate table needs confirmation in the app, or approval in the CLI. See Confirmation.
Describe table
Returns the status, keys, indexes, billing mode, item count and time to live settings of a table.
DNML
[[dynamodb.describeTable]]name = "Inspect orders"tableArn = "arn:aws:dynamodb:ap-southeast-2:123456789012:table/Orders" - The result has
tableandrequestId. tablehasname,arn,status,itemCount,sizeBytes,billingModeandkeySchema. It also hasattributeDefinitions,globalSecondaryIndexes,localSecondaryIndexes,timeToLive,creationDateTimeand, for a table with a stream,streamArn.timeToLiveis{ attribute, status }ornull. Dynomate omits it if your credentials do not have thedynamodb:DescribeTimeToLivepermission.
[[dynamodb.describeTable]] Keys
List tables
Lists the table names in a region.
DNML
[[dynamodb.listTables]]name = "All tables"region = "ap-southeast-2"
The result has tableNames, count and requestId.
Create table
Creates a table with its keys, indexes, capacity and settings. By default, it waits until the table is active.
DNML
[[dynamodb.createTable]]name = "Create orders table"tableArn = "arn:aws:dynamodb:ap-southeast-2:123456789012:table/Orders-dev"ifNotExists = truepartitionKey = { name = "accountId", type = "S" }sortKey = { name = "orderId", type = "S" }timeToLive = { attribute = "expiresAt" }globalSecondaryIndexes = [ { name = "status-index", partitionKey = { name = "status", type = "S" }, sortKey = { name = "orderId", type = "S" }, projection = "keys-only", },] tableArnnames the new table. Dynomate gets the attribute definitions from the keys and indexes.- For DynamoDB Local, use the local account ID in the ARN, for example
000000000000. SetendpointUrlto the local endpoint. - The result has
tableArn,tableName,created,statusandrequestId.createdisfalseififNotExistsfound a table.
[[dynamodb.createTable]] Keys
- partitionKey map Required
- The partition key as { name, type }. The type is "S", "N" or "B". In the app: Schema tab › Partition key
- sortKey map
- An optional sort key as { name, type }. The type is "S", "N" or "B". In the app: Schema tab › Sort key
- billingMode enum: "pay-per-request" | "provisioned"
- The billing mode of the table. The default is "pay-per-request". In the app: Schema tab › Billing mode
- provisionedThroughput map
- Capacity units as { readCapacityUnits, writeCapacityUnits }. Required if billingMode is "provisioned". In the app: Schema tab › Table throughput
- globalSecondaryIndexes array of maps
- Each index has a name, partitionKey, projection, and an optional sortKey and provisionedThroughput. The projection is "all", "keys-only" or { include = [...] }. In the app: Schema tab › Global secondary indexes
- localSecondaryIndexes array of maps
- Local secondary indexes, each with a name, sortKey and projection. In the app: Schema tab › Local secondary indexes
- timeToLive map
- Turns on time to live for the { attribute } after the table is active. In the app: Schema tab › Expiration after creation
- tableClass enum: "standard" | "standard-infrequent-access"
- The storage class of the table. The default is "standard". In the app: Schema tab › Table class
- deletionProtection boolean
- If true, DynamoDB does not delete the table until you remove the protection. The default is false. In the app: Schema tab › Deletion protection
- ifNotExists boolean
- If true and the table exists, the operation succeeds and does not create it. The default is false. In the app: Execution tab › Succeed if the table already exists
- waitForActive boolean
- Waits until the table is active. The default is true, with a five-minute operation timeout. In the app: Execution tab › Wait for active table
Delete table
Deletes a table and all its data. It can check guards before it sends the delete.
DNML
[[dynamodb.deleteTable]]name = "Drop dev table"tableArn = "arn:aws:dynamodb:ap-southeast-2:123456789012:table/Orders-dev"ifExists = trueguard = { expectTableName = "Orders-dev", expectItemCountAtMost = 1000 } - If a guard fails, the operation fails with
DNML_GUARD_FAILED. - The result has
tableName,deletedandrequestId.deletedisfalseififExistsfound no table.
[[dynamodb.deleteTable]] Destructive Keys
- ifExists boolean
- If true and the table does not exist, the operation succeeds. The default is false. In the app: Execution tab › Succeed if the table is already absent
- waitForDeletion boolean
- Waits until the table is gone. The default is true, with a five-minute operation timeout. In the app: Execution tab › Wait for deletion
- guard map
- expectTableName must match the table name exactly. expectItemCountAtMost is the maximum item count that DynamoDB reports. If a check fails, Dynomate deletes nothing. In the app: Guard tab › Table guards
Truncate table
Deletes all items, or all items that match a filter, but keeps the table.
DNML
[[dynamodb.truncate]]name = "Clear expired sessions"tableArn = "arn:aws:dynamodb:ap-southeast-2:123456789012:table/Sessions-dev"filterExpression = "expiresAt < :now"expressionAttributeValues = { ":now" = 1790000000 }guard = { expectTableName = "Sessions-dev" } - Guards work the same as for Delete table.
- If the operation fails or you cancel it, Dynomate does not restore the deleted items.
- The result has
deletedCount,scannedCountandsegmentCount. - To truncate a table from the table view, see Truncate a table.
[[dynamodb.truncate]] Destructive Keys
- segments integer
- The number of parallel scan segments, from 1 to 256. By default, Dynomate sets it. In the app: Execution tab › Scan segments
- scanLimit integer
- Items in each scan page, from 1 to 1,000. The default is 1,000. In the app: Execution tab › Scan page size
- concurrency integer
- The number of segments to process at the same time. The default is 8. In the app: Execution tab › Concurrent workers
- filterExpression string
- Dynomate deletes only the items that match. Without it, Dynomate deletes all items. In the app: Scope tab › Filter expression
- expressionAttributeNames map
- Maps the #name placeholders in expressions to attribute names. In the app: Scope tab › Attribute name aliases
- expressionAttributeValues map
- Maps the :value placeholders in expressions to values, in plain or typed form. In the app: Scope tab › Attribute value aliases
- guard map
- expectTableName must match the table name exactly. expectItemCountAtMost is the maximum item count that DynamoDB reports. If a check fails, Dynomate deletes nothing. In the app: Scope tab › Table guards
Update time to live
Turns time to live expiration on or off for a table attribute.
DNML
version = "1.0"name = "ttl-control"description = "Distinguish the TTL setting from whether an operation runs."[defaults]profileName = "commerce-dev"region = "ap-southeast-2"[[dynamodb.updateTimeToLive]]name = "Disable TTL"tableArn = "arn:aws:dynamodb:ap-southeast-2:123456789012:table/Orders"attribute = "expiresAt"ttlEnabled = false# enabled is omitted, so it defaults to true: execute and disable TTL.# The required TTL field is distinct from the common operation enabled control.[[dynamodb.updateTimeToLive]]name = "Skipped TTL activation"enabled = falsetableArn = "arn:aws:dynamodb:ap-southeast-2:123456789012:table/Orders"attribute = "expiresAt"ttlEnabled = true# This operation is skipped because the common enabled field is false.# With enabled omitted or true, ttlEnabled = true would enable TTL and the# operation would be classified as destructive.
Lines 1–20 of 27
- The operation is destructive only if
ttlEnabledistrue. - The result has
attribute,ttlEnabledandrequestId. - For background, see DynamoDB TTL for data expiry.
[[dynamodb.updateTimeToLive]] Sometimes destructive Keys
- attribute string Required
- The attribute that holds the expiry time of each item. In the app: TTL tab › TTL attribute
- ttlEnabled boolean Required
- Set to true to turn on expiration, or false to turn it off. This is not the enabled key. In the app: TTL tab › Enable expiration