
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
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.
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.
Before diving into the migration magic, ensure you have the following 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.
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.
Before diving into the migration magic, ensure you have the following 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:
- 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.
- Please note that we are setting up AWS permissions since Aurora DSQL uses AWS IAM-based authentication. If your database uses conventional connection user name and password authentication, this step is not required.
- Set up your AWS credentials to have the following permissions for Aurora DSQL (https://docs.aws.amazon.com/aurora-dsql/latest/userguide/authentication-authorization.html#authentication-authorization-iam-role-connect).
dsql:DbConnectAdmin
- Required to connect to your cluster using the default `admin` role
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.
Amazon Q CLI interpreted this prompt and automatically:
- Environment Setup :
- Created a Python virtual environment- Installed required packages (
`pymysql`, `psycopg2-binary`, `boto3`
and configured AWS authentication- 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
- 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 - Data Quality Fixes- Automatically detected and fixed invalid dates- Replaced day '00' with '01' in date fields- Maintained data integrity throughout the process
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).
This example demonstrates how Amazon Q CLI bridges the gap between intent and execution:
- Natural Language Understanding: Interpreted complex requirements from a simple prompt
- Domain Expertise: Applied database migration best practices automatically
- Cloud Integration: Seamlessly handled AWS service authentication and APIs
- Error Prevention: Anticipated and avoided common migration pitfalls
- Verification: Data integrity checks and reporting
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.