AWS Logo
Menu
Using Amazon Q CLI to Migrate to Aurora DSQL

Using Amazon Q CLI to Migrate to Aurora DSQL

How to use Amazon Q CLI to migrate your databases with confidence.

Gopinath Srinivasan
Amazon Employee
Published Jun 8, 2025

The Challenge

Database migrations are traditionally complex, time-consuming tasks that require deep technical expertise, careful planning, and extensive scripting. When faced with a heterogeneous database migration scenario, most teams would expect weeks of preparation, custom code development, and testing of those scripts.
But what if you could accomplish this with just a simple conversational prompt using Amazon Q Developer CLI ? I'll show how you can accomplish this by migrating a database from MariaDB(on-prem, self-hosted or on AWS) to Aurora DSQL.

Enter Amazon Q CLI

Amazon Q CLI transforms how we approach complex technical tasks by understanding natural language requests and executing sophisticated workflows. In this example, we'll demonstrate how a single prompt can orchestrate an entire database migration from MariaDB to Aurora DSQL.

Prerequisites

Before diving into the migration magic, ensure you have the following setup:
Amazon Q CLI Setup
1. Install Amazon Q CLI
Follow the installation guide for your platform, available at: https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-installing.hThe Challenge. Open q chat. Login with your credential, if needed. I'll be using Q Developer Pro for my migration exercise.
Database migrations are traditionally complex, time-consuming tasks that require deep technical expertise, careful planning, and extensive scripting. When faced with a heterogeneous database migration scenario, most teams would expect weeks of preparation, custom code development, and testing of those scripts.
But what if you could accomplish this with just a simple conversational prompt using Amazon Q Developer CLI ? I'll show how you can accomplish this by migrating a database from MariaDB(on-prem, self-hosted or on AWS) to Aurora DSQL.

Enter Amazon Q CLI

Amazon Q CLI transforms how we approach complex technical tasks by understanding natural language requests and executing sophisticated workflows. In this example, we'll demonstrate how a single prompt can orchestrate an entire database migration from MariaDB to Aurora DSQL.

Prerequisites

Before diving into the migration magic, ensure you have the following setup:
Amazon Q CLI Setup
1. Install Amazon Q CLI
Follow the installation guide for your platform, available at: https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/command-line-installing.html. Open q chat. Login with your credential, if needed. I'll be using Q Developer Pro for my migration exercise.
2. Configure Claude 4 Sonnet Model
Set the model to Claude 4 Sonnet for optimal performance:
System Requirements
  • Python 3.8+ installed on your system
  • AWS CLI v2 configured with appropriate permissions-
  • Database access to both source (MariaDB) and target (Aurora DSQL)
  • AWS Permissions for Aurora DSQL.

The Prompt
 

Use the below prompt for migrating to Aurora DSQL.
Understanding the prompt:
  • We're front loading key nuances of Aurora DSQL since this database is newly announced and we want to minimize cycles being spent by Amazon Q CLI troubleshooting failures, and investigating probable solutions. Given additional time, Q CLI agent will likely figure out the solution for challenges with data types and other key differences.
  • We have also called out authentication that Q CLI should use
  • Grounded testing the outcome by verifying row counts in source and target.
  • Execute without asking permission.
That's it. No detailed specifications, no architecture diagrams, no step-by-step instructions. As indicated earlier, the instructions are more detailed to account for the newly announced database, Aurora DSQL.

What Happened Behind the Scenes

Amazon Q CLI interpreted this prompt and automatically:
  1. Environment Setup :
- Created a Python virtual environment- Installed required packages (`pymysql`, `psycopg2-binary`, `boto3` and configured AWS authentication
  1. Intelligent Code Generation: Generated a comprehensive migration script that included: Configuration file parsing, Database connection management, Schema analysis and conversion- Data type mapping with DSQL-specific adaptations, Error handling and logging
  2. DSQL-Specific Adaptations : Q CLI understood Aurora DSQL's unique characteristics and automatically:- Converted `tinyint(1)` to `SMALLINT`- Mapped MariaDB data types to PostgreSQL-compatible types- Handled authentication using AWS IAM tokens- Avoided unsupported features (foreign keys, sequences)- Implemented asynchronous index creation
  3. Data Quality Fixes- Automatically detected and fixed invalid dates- Replaced day '00' with '01' in date fields- Maintained data integrity throughout the process

The Results

When run with a sample MariaDB database, all the tables and indexes migrated successfully and the results were stored in a log (the numbers below are redacted and anonymized).

The Power of Conversational AI

This example demonstrates how Amazon Q CLI bridges the gap between intent and execution:
  1. Natural Language Understanding: Interpreted complex requirements from a simple prompt
  2. Domain Expertise: Applied database migration best practices automatically
  3. Cloud Integration: Seamlessly handled AWS service authentication and APIs
  4. Error Prevention: Anticipated and avoided common migration pitfalls
  5. Verification: Data integrity checks and reporting

Conclusion

While this showcases a database migration, the same approach works for other migration technical tasks. As with all generative AI based solutions, the output and/or outcome might vary a bit for you.
Amazon Q CLI represents a shift in how we approach complex technical tasks. By combining natural language understanding with migration technical expertise, it transforms hours or days of manual work into minutes of automated execution.
Ready to try Amazon Q CLI for your database migrations or any other use case? Here's how you can start !!
 

Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.

Comments