Run Liquibase commands as task definitions

Last updated: July 14, 2025

There are multiple ways to operate Liquibase container within AWS. The example provided is specific to containers in ECS, and is one of several solutions. A task definition is a JSON text file that outlines how your containers operate in ECS. In the context of Liquibase, you write task definitions to run Liquibase commands on AWS. Follow the guide below to learn how to create Liquibase specific task definitions.

Before you begin

Required additional AWS Resources:

  • MySQL RDS Instance - If you are using MySQL DB

  • AWS Fargate ECS cluster

  • IAM role to access the CloudWatch Logs, create Task Definitions, etc.

Procedure

1

Navigate to the Task definitions section on the left side navigation. Here you can define the Task definitions for the Liquibase commands you wish to run.

task-def
2

Optional: Place the full image URL in a task definition to extend the Docker image

You may want to extend your Docker image if you have several services that reuse a common set of configuration options or you use external tools like SQL Plus or SQLCMD. To extend our docker image and add other databases for a specific task definition, you must use the image URL that displays the ECR repository. Here is the repository URL that can be extended: 709825985650.dkr.ecr.us-east-1.amazonaws.com/liquibase/liquibase/liquibase-pro:4.33.0

Note: You must use the ECR image URL displayed in the task definition to extend our docker image.

3

Check the box next to the specific definition you want to revise.

task-def-checkbox
4

Click the Create new revision drop down menu and select Create new revision with JSON.

create-revision
5

From the Create new revision page you will see the line that starts with image; place the URL here to extend the docker image.

copy of image (5)
6

Run a task definition by selecting the radio button next to the desired definition. In this example we will use connect-command.

7

Select the Deploy button at the top of the screen.

8

From the drop-down menu, select run task.

copy of image (9)
9

Select the Compute options that you desire. In this example we will toggle Launch type on.

compute-opts
10

Click the Create button.

11

AWS will bring you to the tasks in your cluster. You will be able to see the task that is running in the Tasks tab below the Cluster Overview.

running-task
12

Click on the task that is running in the Tasks tab.

13

Click on the Logs tab to see all log events on any container you have specified in the Task Definition.

step 13 image
Run Liquibase commands as task definitions - Liquibase