updateTableProvisionedThroughput

updateTableProvisionedThroughput is a Change Type in the Liquibase DynamoDB Pro extension that updates an existing table. It only works for tables that use the PROVISIONED billing mode.

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.

Amazon DynamoDB has two pricing models for the number of read and write operations you perform on tables in your database every second:

  • On-demand (PAY_PER_REQUEST): only pay for requests you actually make
  • Provisioned (PROVISIONED): you pay for a specific maximum number of requests per second

For more information, see Read/write capacity mode.

You can use updateTableProvisionedThroughput to update tables that use the PROVISIONED billing mode.

If you try to use updateTableProvisionedThroughput to update a table that uses the PAY_PER_REQUEST billing mode, Liquibase returns an error. This occurs even if you're trying to switch to the PROVISIONED billing mode. Instead, you must use updateDynamoTable.

Run updateTableProvisionedThroughput

To run this Change Type, follow these steps:

  1. Add the Change Type to your changeset, as shown in the examples on this page.
  2. Specify any required attributes. Use the table on this page to see which ones your database requires.
  3. Deploy your changeset by running the update command:
  4. liquibase update

Now, Liquibase deploys your change on 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 Pro.

Available attributes

For more information, see DynamoDB API UpdateTable.

Name Type Description Requirement
tableName String

Name of the table to update

Required
readCapacityUnits Integer

The maximum number of reads per second before DynamoDB returns a ThrottlingException.

Optional
writeCapacityUnits Integer The maximum number of writes per second before DynamoDB returns a ThrottlingException. Optional

Examples

databaseChangeLog:
  - changeSet:
      id: 2
      author: your.name
      changes:
        - updateTableProvisionedThroughput:
            tableName: MusicProvisionedThroughputTestXML
            readCapacityUnits: 20
            writeCapacityUnits: 20
      rollback:
        empty
{
  "databaseChangeLog": [
    {
      "changeSet": {
        "id": "2",
        "author": "your.name",
        "changes": [
          {
            "updateTableProvisionedThroughput": {
              "tableName": "MusicProvisionedThroughputTestJson",
              "readCapacityUnits": 20,
              "writeCapacityUnits": 20
            }
          }
        ],
        "rollback": [
          {
            "empty": {
            }
          }
        ]
      }
    }
  ]
}
<databaseChangeLog
    xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:dynamodb="http://www.liquibase.org/xml/ns/pro-dynamodb"
    xmlns:pro="http://www.liquibase.org/xml/ns/pro"
    xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
        http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd
        http://www.liquibase.org/xml/ns/pro-dynamodb
        http://www.liquibase.org/xml/ns/pro-dynamodb/liquibase-pro-dynamodb-latest.xsd
        http://www.liquibase.org/xml/ns/pro
        http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd">

    <changeSet id="2" author="your.name">
        <dynamodb-pro:updateTableProvisionedThroughput tableName="MusicProvisionedThroughputTestXML" readCapacityUnits="20" writeCapacityUnits="20" />

        <rollback/>
    </changeSet>

</databaseChangeLog>

Database support

This Change Type is only supported for Amazon DynamoDB. It does not support auto rollback.