createDynamoTable
Last updated: September 2, 2025
createDynamoTable is a Change Type in the Liquibase DynamoDB Secure extension that creates a new table.
Uses
A DynamoDB table is a collection of data. It contains some number of items (rows), which may each contain any attributes (columns). For more information, see Core components of Amazon DynamoDB.
This Change Type does not support auto rollback.
Run createDynamoTable
To run this Change Type, follow these steps:
Add the Change Type to your changeset, as shown in the examples on this page.
Specify any required attributes. Use the table on this page to see which ones your database requires.
Deploy your changeset by running the
updatecommand:liquibase update
Now, Liquibase deploys your change to your DynamoDB database. By default, read operations on DynamoDB are eventually consistent. When you look at your database immediately after running liquibase update, DynamoDB may display the status of an object as CREATING, UPDATING, or DELETING. When it finishes, it displays the status as ACTIVE.
Note: If your deployment fails because the DynamoDB waiter times out or reaches a retry limit, you can modify the waiter settings using Liquibase Parameters for Amazon DynamoDB Secure.
Available attributes
For more information, see DynamoDB API: CreateTable.
You must specify all top-level attributes marked as required. If you specify an optional attribute, you must also specify any nested attributes that it requires.
Name | Type | Description | Requirement |
| String | Name of the table to create | Required |
| String | Billing mode for requests related to the table. Valid values are Note: The default billing mode for Liquibase Tracking Tables is | Optional |
| String | Class of the table. Valid values are | Optional |
| Boolean | Whether the table is protected from being deleted by another operation. Default: | Optional |
keySchema (required)
Specifies the attributes that make up the primary key for the table. The primary key can either be a simple primary key (partition key only) or a composite primary key (partition key combined with sort key).
You must specify all attributes you use in keySchema within individual attributeDefinition objects in the attributeDefinitions array. For example, if your key schema contains the hash attribute Artist, you must also specify Artist and its data type in an attributeDefinition. However, attributeDefinitions can contain additional non-key attributes that aren't in keySchema.
keySchema has the following nested attributes:
hashAttributeName(string) (required): The name of the partition key. DynamoDB uses an internal hash function to evenly distribute data items across partitions, based on their partition key values.rangeAttributeName(string) (required): The name of the sort key. DynamoDB stores items with the same partition key physically close together, in sorted order by the sort key value.
Note: When you specify keySchema at the top level of createDynamoTable, it applies to the primary key for the table. When you specify keySchema within localSecondaryIndex or globalSecondaryIndex, it applies to the primary key for the index.
attributeDefinitions (required)
An array of attributeDefinition objects that describe attributes from the key schema of a table or index.
You must specify all attributes you use in keySchema within individual attributeDefinition objects in the attributeDefinitions array. For example, if your key schema contains the hash attribute Artist, you must also specify Artist and its data type in an attributeDefinition. However, attributeDefinitions can contain additional non-key attributes that aren't in keySchema.
Individual attributeDefinition objects have the following nested attributes:
attributeName(string) (required): the name of the attribute.attributeType(string) (required): the data type of the attribute. Valid values areS(string),N(number), andB(binary).
provisionedThroughput (sometimes required)
Specifies the provisioned throughput settings for the table. You can modify these settings using the updateDynamoTable and updateTableProvisionedThroughput Change Types.
If you set
billingModetoPROVISIONED, or if you do not explicitly setbillingMode, thenprovisionedThroughputis required.If you set
billingModetoPAY_PER_REQUEST, you cannot specifyprovisionedThroughput.
Note: If you originally set billingMode to PROVISIONED and want to change it to PAY_PER_REQUEST, you must do this with updateDynamoTable. You cannot use updateTableProvisionedThroughput because it only accepts the PROVISIONED billing mode.
provisionedThroughput has the following nested attributes:
readCapacityUnits(integer) (required): the maximum number of reads per second before DynamoDB returns aThrottlingException. Minimum valid value:1.writeCapacityUnits(integer) (required): the maximum number of writes per second before DynamoDB returns aThrottlingException. Minimum valid value:1.
If you set billingMode to PAY_PER_REQUEST, Liquibase sets the values of readCapacityUnits and writeCapacityUnits to 0. For more information, see Read/write capacity mode and Managing settings on DynamoDB provisioned capacity tables.
Note: When you specify provisionedThroughput at the top level, it applies to the table. When you specify provisionedThroughput within globalSecondaryIndex, it applies to the index.
localSecondaryIndexes (optional)
An array of localSecondaryIndex objects to be created on the table. You can specify between 1 and 5 local secondary indexes on a table. Each index is scoped to a given partition key (primary key) value. There is a 10 GB size limit per partition key value, but no other size limits.
Individual localSecondaryIndex objects have the following nested attributes:
indexName(string) (required): the name of the local secondary index. The name must be unique among all other indexes on this table.keySchema(required): the key schema for the local secondary index;hashAttributeName(string) (required): the name of the partition key;rangeAttributeName(string) (required): the name of the sort key.projection(required): specifies attributes copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of:projectionType(string) (optional): specifies which kinds of attributes are projected into the index. Valid values areKEYS_ONLY(only project the index and primary keys),INCLUDE(project the index and primary keys as well as other non-key attributes), andALL(project all table attributes). The default value isALL; nonKeyAttributes(optional): an array of non-key attributes which will be projected into the index. You can specify between 1 and 20 non-key attributes in a single secondary index. You can specify up to 100 non-key attributes across all local and global secondary indexes on a particular table (duplicate non-key attributes are counted multiple times).attributeName(string) (optional): the name of this particular non-key attribute.
globalSecondaryIndexes (optional)
An array of individual globalSecondaryIndex objects to create on the table. You can specify between 1 and 20 global secondary indexes on a particular table.
Individual globalSecondaryIndex objects have the following nested attributes:
indexName(string) (required): the name of the local secondary index. The name must be unique among all other indexes on this table.keySchema(required): the key schema for the local secondary index.globalSecondaryIndexes(optional: hashAttributeName(string) (required): the name of the partition key;rangeAttributeName(string) (required): the name of the sort key.projection(required): specifies attributes copied (projected) from the table into the index. These are in addition to the primary key attributes and index key attributes, which are automatically projected. Each attribute specification is composed of:projectionType(string) (optional): specifies which kinds of attributes are projected into the index. Valid values areKEYS_ONLY(only project the index and primary keys),INCLUDE(project the index and primary keys as well as other non-key attributes), andALL(project all table attributes). The default value isALL; nonKeyAttributes(optional): an array of non-key attributes which will be projected into the index. You can specify between 1 and 20 non-key attributes in a single secondary index. You can specify up to 100 non-key attributes across all local and global secondary indexes on a particular table (duplicate non-key attributes are counted multiple times);attributeName(string) (optional): the name of this particular non-key attribute.provisionedThroughput(optional): specifies the provisioned throughput settings for the index.readCapacityUnits(integer) (required): the maximum number of reads per second before throttling.writeCapacityUnits(integer) (required): the maximum number of writes per second before throttling.
tags (optional)
An array of tag objects, which are key-value pairs you can use to label the table. Individual tag objects have the following nested attributes:
key(string) (required): the case-sensitive name of the tag. Must be unique from other tag keys on the table. Cannot be null.value(string) (required): the case-sensitive value of the tag. Can be null.
For more information, see Tagging for DynamoDB.
streamSpecification (optional)
The settings for DynamoDB Streams on the table. streamSpecification has the following nested attributes:
streamEnabled(Boolean) (required): indicates whether DynamoDB Streams is to be enabled (true) or disabled (false).streamViewType(string) (optional): When an item in the table is modified, this specifies what to write to the table's stream about that item. Valid values are:KEYS_ONLY(only the item's key attributes),NEW_IMAGE(the entire item after it was modified),OLD_IMAGE(the entire item before it was modified),NEW_AND_OLD_IMAGES(the entire item before and after it was modified).
sseSpecification (optional)
The settings to enable server-side encryption for the table. sseSpecification has the following nested attributes:
enabled(Boolean) (optional): Iftrue, enables server-side encryption by the AWS Key Management Service (KMS). Iffalse, server-side encryption uses an AWS owned key. The default value isfalse.sseType(string) (optional): the type of server-side encryption to use. The only supported value isKMS. The key is stored in your account and is managed by AWS KMS.kmsMasterKeyId(string) (optional): The AWS KMS key is to be used for encryption. To specify a key, use its key ID, Amazon Resource Name (ARN), alias name, or alias ARN. You should only provide this attribute if the key is different from the default DynamoDB key:alias/aws/dynamodb.