Using Liquibase with AWS Redshift

Amazon Web Services Redshift is a fully managed, petabyte-scale data warehouse service in the cloud. An AWS Redshift data warehouse is a collection of computing resources called nodes. The nodes are organized into a group called a cluster. Each cluster runs an AWS Redshift engine and contains one or more databases.

Note: For more information, see the Amazon Redshift documentation page.

Supported Versions

  • 3.0.28 – officially supported and tested with Test Harness


Before using Liquibase with your database, ensure you have:

Driver Information

To use Liquibase and AWS Redshift, you need to have two jar files: JDBC and the Liquibase Redshift extension:

  1. Ensure you have downloaded the Amazon Redshift JDBC driver. You can download the JDBC 4.2–compatible driver (without the AWS SDK). If you use the Amazon Redshift JDBC driver for database authentication, make sure that you have AWS SDK for Java 1.11.118 or later in your Java class path. If you don't have AWS SDK for Java installed, download the ZIP file with the JDBC 4.2–compatible driver (without the AWS SDK) and driver dependent libraries for the AWS SDK.
  2. Place the redshift-jdbc<version>.jar file in the liquibase/lib directory.
  3. Example: redshift-jdbc42-

  1. Open the Liquibase properties file and add the driver value:
  2. driver:
  1. Go to the liquibase-redshift repository and download the latest released Liquibase extension liquibase-redshift-<version>.jar file.
  2. Place the liquibase-redshift-<version>.jar file in the liquibase/lib directory.
  3. If you put the redshift-jdbc<version>.jar and liquibase-redshift-<version>.jar files in a different directory, specify the path in the Liquibase properties file, as follows:

    Windows example:

    classpath:"..path_to_your\\drivers\\redshift-jdbc<version>.jar; ..path_to_your\\liquibase-redshift-<version>.jar"

    Linux example:

    classpath:"../path_to_your/drivers/redshift-jdbc<version>.jar; ..path_to_your/liquibase-redshift-<version>.jar"

If you use Maven, you also need to download the AWS Redshift driver JAR file and put the driver in a location that your Maven build can access. Configure the Maven pom.xml file to use the local copy of the driver JAR file. For example:


Additionally, you need to specify the Liquibase Redshift extension in your pom.xml file as explained in Configuring Liquibase Attributes in your Maven POM File. Make sure that the Liquibase plugin and the extension have the same version.


Testing Your Connection

For Liquibase and AWS Redshift to work, you need to:

  1. Ensure your AWS Redshift database is configured. You can check the connection to an Amazon Redshift cluster.
  2. Specify the database URL in the Liquibase properties file, as follows:
  3. url: jdbc:redshift://endpoint:port/database

    Example: url: jdbc:redshift://<cluster-identifier>

    Note: To get your JDBC connection, see Finding your cluster connection string.

  4. Create a text file called changelog (.xml, .sql, .json, or .yaml) in your project directory and add a changeset.

  1. Navigate to your project folder in the CLI and run the Liquibase status command to see whether the connection is successful. You can pass arguments in the CLI or keep them in the Liquibase properties file.
  2. liquibase --username=test --password=test --changelog-file=<changelog.xml> status
  3. Run your first update with the update command, which makes changes to your database. You can also run the update-sql command to inspect the SQL before running the update command.
  4. liquibase --changelog-file=<changelog.xml> update-sql
    liquibase --changelog-file=<changelog.xml> update

From a database UI tool, ensure that your database contains the table you added along with the DATABASECHANGELOG table and DATABASECHANGELOGLOCK table.

Related Links