
Q-Bits: Streamline RDS Operations with AWS CLI and Amazon Q Developer
This blog post explores how Amazon Q Developer simplifies performing complex RDS operations via AWS CLI
Welcome to another installment of Q-Bits , our regular series showcasing cool ways Amazon employees are leveraging Amazon Q Developer. Today, we're diving into how Q Developer can assist with RDS operations in AWS CLI.
Amazon RDS has been a key component in a lot of architectures that I have built over several years both for proof-of-concepts and production applications. When working with Amazon RDS, AWS CLI comes really handy - whether it's querying cluster attributes, understanding backup configurations, identifying snapshot details, or creating read replicas. However, I often struggle with crafting the perfect CLI command. It's hard for me to remember all the different sub-commands, various parameters, and query options.
This is where Amazon Q Developer has been really helpful. It has completely transformed how I approach RDS management via AWS CLI. It simplifies various RDS management and query operations by creating accurate CLI commands, reducing the amount of time I need to spend scrolling through AWS CLI documentation or through trial and error.
Let's look at a few examples. In my AWS Account, I have a number of RDS database instances that I have deployed for multiple applications. I know the name of the RDS database cluster that I created but I would like to know the database engine for the same. With Amazon Q Developer, I can simply type:
List RDS DB Cluster identifier and engine version where db id contains demo As I hit enter, Amazon Q Developer translates my natural language instruction into an AWS CLI command.
Bash
aws rds describe-db-clusters \--query 'DBClusters[?contains(DBClusterIdentifier, `demo`)].[DBClusterIdentifier,Engine,EngineVersion]' \--output table
Running the command returns following output.

Now that I know the DB Identifier of my RDS database cluster, I can perform further queries on it. I want to know the backup information of my database. I can simply ask Amazon Q Developer:
List RDS backup configuration for aurora-cluster-demo And I get a CLI command to get backup configuration for my database.
Bash
aws rds describe-db-clusters \--db-cluster-identifier aurora-cluster-demo \--query 'DBClusters[].[DBClusterIdentifier,BackupRetentionPeriod,PreferredBackupWindow,EarliestRestorableTime,LatestRestorableTime]' \--output table
Next, I would like to see the snapshots of my RDS database. With Amazon Q Developer, I can simply type:
list RDS DB snapshots for aurora-cluster-demo And Amazon Q Developer provides a CLI command that I can use to check snapshot information, with create time and status:
Bash
aws rds describe-db-cluster-snapshots \--db-cluster-identifier aurora-cluster-demo \--query 'DBClusterSnapshots[].[DBClusterSnapshotIdentifier,SnapshotType,Status,SnapshotCreateTime]' \--output table
So far, I have used Amazon Q Developer to create CLI commands to learn about various configurations (snapshot, backup) of my RDS database cluster. Now, I want to take action on my database cluster and create a read replica instance. Instead of writing a long and complex CLI command myself, I ask Amazon Q Developer:
create a read replica of auroa-cluster-demo And Amazon Q Developer provides a CLI command to create a read replica of my "aurora-cluster-demo" database. Interestingly, even when I made a typo in my request (missing 'r' in aurora), Amazon Q Developer provided the CLI command with the correct identifier name.
Bash
aws rds create-db-instance \--db-instance-identifier aurora-cluster-demo-replica \--db-cluster-identifier aurora-cluster-demo \--db-instance-class db.r5.large \--engine aurora-mysql \--availability-zone us-east-1a
Running the above command creates a read replica instance for my database.
Finally, I want to see all the RDS events that have happened in the last 24 hours. I can ask Amazon Q Developer:
list rds events for last 24 hours Amazon Q Developer creates the right CLI command to query last 24-hour RDS events:
Bash
aws rds describe-events \--duration 1440 \--query 'Events[].[Date,SourceType,SourceIdentifier,Message]' \--output table
Now that you've seen how Amazon Q Developer can transform your RDS operations via CLI, I encourage you to try it today. Start small – try finding that one database instance that always seems to hide among dozens of others, or generate a backup configuration command you've been meaning to update. The beauty of Amazon Q Developer is that you can experiment safely, reviewing each generated command before execution.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article