DynamoChangetypeAttributes

The DynamoChangetypeAttributes changelog check validates whether a specified attribute of a Dynamo changetype is set to an exact value or pattern.

Uses

Property

Value

Liquibase version required

4.31.0+

Scope (--checks-scope)

changelog

Default status

disabled

Default severity (exit code)

0 ("INFO")

Customizable settings

Yes (dynamic)

Prerequisites

Uses

Use this check to enforce naming conventions, security standards, or deployment rules by validating specific fields in DynamoDB change types. You can define multiple checks with different attributes and patterns to match your standards across various Change types.

When does this check trigger?

This check is fully driven by how you configure it. Once configured, the check will trigger only when all of the following are true:

  1. A changeset contains the specific Change type you specified, such as createDynamoTable.

  2. That Change type includes the attribute that you're checking, such as billingMode.

If the Change type isn’t used, or the attribute isn’t present, the check doesn’t run. This ensures you're only enforcing rules when that part of the changelog is relevant.

Procedure

1

Procedure

This check is disabled by default. To enable it, run the enable command:

liquibase checks enable --check-name=DynamoChangetypeAttributes
2

Liquibase will prompt you to name your custom version of the check.

By default, it will be named DynamoChangetypeAttributes1. You can accept the default by pressing Enter or enter a custom name.

3

Set the severity level. This determines the exit code when the check is triggered.

  • INFO (0)

  • MINOR (1)

  • MAJOR (2)

  • CRITICAL (3)

  • BLOCKER (4)

4

Set the DynamoDB changetype this check will inspect.

You’ll be prompted with: Set 'DYNAMO_CHANGE_TYPE' (options: CREATE_DYNAMO_TABLE, UPDATE_DYNAMO_TABLE, DELETE_DYNAMO_TABLE, CREATE_GLOBAL_SECONDARY_INDEX, UPDATE_GLOBAL_SECONDARY_INDEX, DELETE_GLOBAL_SECONDARY_INDEX, PARTIQL, PARTIQL_FILE, UPDATE_TABLE_PROVISIONED_THROUGHPUT):

  • Only one changetype is allowed per check

  • Input is case-insensitive

  • Don't include commas or multiple values. Only input one valid name

5

Once you've selected the changetype, you'll be walked through its specific attributes.

These are based on the changetype you chose. You can modify these examples to fit your own use case.

CREATE_DYNAMO_TABLE — Used to create a new DynamoDB table. You can enforce naming conventions, capacity mode, deletion protection, table class, and key schema settings.

This example creates a table with PAY_PER_REQUEST billing mode and deletion protection enabled. Replace your_table_name, hash key, and range key names to match your schema.

Set 'TABLE_NAME' (requires string): your_table_name Set 'BILLING_MODE' (options: PROVISIONED, PAY_PER_REQUEST): PAY_PER_REQUEST Set 'DELETION_PROTECTION_ENABLED' (options: true, false): true Set 'TABLE_CLASS' (options: STANDARD, STANDARD_INFREQUENT_ACCESS): STANDARD Set 'KEY_SCHEMA_HASH_NAME' (requires string): id Set 'KEY_SCHEMA_RANGE_NAME' (requires string): timestamp

UPDATE_DYNAMO_TABLE — Used to modify an existing DynamoDB table. You can enforce constraints on billing mode changes and deletion protection.

This example requires that any table update must keep deletion protection enabled. Replace your_table_name with the name of your table.

Set 'TABLE_NAME' (requires string): your_table_name Set 'BILLING_MODE' (options: PROVISIONED, PAY_PER_REQUEST): PROVISIONED Set 'DELETION_PROTECTION_ENABLED' (options: true, false): true

DELETE_DYNAMO_TABLE — Used to drop a DynamoDB table. You can enforce rules around deletion protection status at the time of deletion.

Set 'TABLE_NAME' (requires string): your_table_name Set 'DELETION_PROTECTION_ENABLED' (options: true, false): false

CREATE_GLOBAL_SECONDARY_INDEX — Used to add a global secondary index (GSI) to a DynamoDB table. You can enforce index naming, key schema, projection type, and throughput settings.

This example requires that all GSIs project all attributes and include both a hash and range key. Replace your_index_name with the name of your index.

Set 'INDEX_NAME' (requires string): your_index_name Set 'KEY_SCHEMA_HASH_NAME' (requires string): status Set 'KEY_SCHEMA_RANGE_NAME' (requires string): created_at Set 'PROJECTION_TYPE' (options: KEYS_ONLY, INCLUDE, ALL): ALL Set 'PROVISIONED_THROUGHPUT_READ_CAPACITY' (requires positive integer): 5 Set 'PROVISIONED_THROUGHPUT_WRITE_CAPACITY' (requires positive integer): 5

UPDATE_GLOBAL_SECONDARY_INDEX — Used to update provisioned throughput settings on an existing GSI. Replace your_index_name with your index name.

Set 'INDEX_NAME' (requires string): your_index_name Set 'PROVISIONED_THROUGHPUT_READ_CAPACITY' (requires positive integer): 10 Set 'PROVISIONED_THROUGHPUT_WRITE_CAPACITY' (requires positive integer): 10

DELETE_GLOBAL_SECONDARY_INDEX — Used to remove a GSI from a DynamoDB table. Replace your_index_name with your index name.

Set 'INDEX_NAME' (requires string): your_index_name

PARTIQL — Used for inline PartiQL statements that run directly against DynamoDB.

PARTIQL_FILE — Used to load DynamoDB PartiQL commands from an external file. You can enforce rules on the file path, encoding, and whether the path is relative to the changelog.

This example requires that the file path is relative to the changelog. Replace /your-directory/dynamo-commands.sql with the actual path to your PartiQL file.

Set 'DBMS' (options: DYNAMODB, MONGODB) [DYNAMODB]: DYNAMODB Set 'PATH' (requires string for the file path of the PartiQL commands to load): /your-directory/dynamo-commands.sql Set 'RELATIVE_TO_CHANGELOG' (options: true, false) [false]: true

UPDATE_TABLE_PROVISIONED_THROUGHPUT — Used to modify the provisioned throughput (read/write capacity units) of a DynamoDB table. Replace your_table_name with the name of your table.

Set 'TABLE_NAME' (requires string): your_table_name Set 'PROVISIONED_THROUGHPUT_READ_CAPACITY' (requires positive integer): 10 Set 'PROVISIONED_THROUGHPUT_WRITE_CAPACITY' (requires positive integer): 10

Example Output

Short Name

Scope

Type

Status

Severity

Customization

Description

DynamoChangetypeAttributes1

changelog

sql, xml, yaml, json

enabled

1

DYNAMO_CHANGE_TYPE = CREATE_DYNAMO_TABLE BILLING_MODE = PAY_PER_REQUEST DELETION_PROTECTION_ENABLED = true

This check triggers when Dynamo changetype attributes do not match the user-supplied string or regex pattern.

Liquibase command 'checks enable' was executed successfully.