AWS Certified DevOps Engineer – ProfessionalSDLC AutomationHard

A company is migrating its legacy application to AWS. The application has a complex database schema that evolves frequently. The DevOps team needs to automate database schema migrations as part of their CI/CD pipeline, ensuring that schema changes are applied incrementally, are reversible, and are tracked in version control. Which open-source tool is commonly integrated into CI/CD pipelines for this purpose, and how should it be used?

  1. ALiquibase, by including migration scripts in the application's source code repository and executing them via CodeBuild.
  2. BChef or Puppet, by defining database schema as infrastructure as code and applying it with configuration management.
  3. CFlyway, by packaging database scripts with the application and running them during a CodeDeploy hook.
  4. DAWS Database Migration Service (DMS), by configuring migration tasks to apply schema changes.
Show answer & explanation

Correct answer: A. Liquibase, by including migration scripts in the application's source code repository and executing them via CodeBuild.

Liquibase is a popular open-source tool for database schema version control and migration. It allows defining schema changes as scripts (XML, YAML, JSON, SQL) that are version-controlled alongside the application code. Integrating it into the CI/CD pipeline, typically within a CodeBuild step, allows for automated, incremental, and reversible database schema updates. Flyway is also a correct tool, but the option for Liquibase is more comprehensive in its description of how it should be used.

Why the other options are wrong

  • B. Chef or Puppet are configuration management tools, primarily for managing server configurations and software installations, not for versioning and applying incremental database schema changes. While they can execute scripts, specialized tools like Liquibase or Flyway are better suited for database migrations.
  • C. Flyway is also a correct tool for database migrations, but the option's description of 'packaging database scripts with the application and running them during a CodeDeploy hook' is less specific about version control and the incremental/reversible nature compared to Liquibase in option A.
  • D. AWS DMS is primarily for migrating data between databases, not for managing incremental, version-controlled, and reversible schema changes as part of a CI/CD pipeline for evolving applications.

Database Schema Migration in CI/CD

Automating the process of applying incremental and reversible database schema changes as part of a continuous integration and continuous delivery pipeline, ensuring consistency and version control.

  • Schema changes are version-controlled alongside application code.
  • Tools like Liquibase or Flyway manage the migration process.
  • Migrations are typically executed during the build or deployment stage.
  • Ensures database state matches application code requirements.

Memory trick: Liquibase scripts build the database, version by version.

More SDLC Automation questions