AWS Certified DevOps Engineer – ProfessionalSDLC AutomationHard
A global software company is developing a new SaaS product that will be deployed across multiple AWS regions. They need to ensure that their database schema changes are applied consistently and safely across all environments (development, staging, production) and regions as part of their CI/CD pipeline. The solution must support rollbacks and prevent unauthorized or inconsistent schema modifications. Which approach should the DevOps team implement?
- AManually apply SQL scripts to each database instance in every environment and region.
- BStore SQL scripts in an S3 bucket and run them via AWS Systems Manager Run Command.
- CUse AWS CloudFormation to manage database schema changes as part of the infrastructure.
- DImplement a database migration tool (e.g., Flyway, Liquibase) integrated into the CodePipeline.
Show answer & explanationAnswer & explanation
Correct answer: D. Implement a database migration tool (e.g., Flyway, Liquibase) integrated into the CodePipeline.
Integrating a dedicated database migration tool (like Flyway or Liquibase) into the CodePipeline is the best approach. These tools manage schema versions, apply migrations incrementally, and provide rollback capabilities, ensuring consistency and safety across multiple environments and regions.
Why the other options are wrong
- A. Manual application is error-prone, inconsistent, lacks version control, and cannot be easily rolled back, failing to meet safety and consistency requirements.
- B. While S3 and Run Command can execute scripts, they lack the versioning, state management, and rollback capabilities inherent in dedicated database migration tools, making them insufficient for safe and consistent schema changes.
- C. AWS CloudFormation is primarily for infrastructure provisioning, not for managing incremental, stateful database schema changes. While it can provision databases, it's not designed for the nuanced versioning and migration of schema itself.
Database Schema Migration in CI/CD
The practice of automating and managing database schema changes (migrations) as part of the CI/CD pipeline, ensuring consistency, version control, and safe application across environments.
- Uses tools like Flyway or Liquibase.
- Migrations are versioned and idempotent.
- Supports forward and backward (rollback) compatibility.
Memory trick: For schema changes, use a migration tool; don't just script or IaC it.