DEV Community

Cover image for Getting Started with AWS RDS: Create, Connect and Query a MySQL Database in the Cloud
Jackon
Jackon

Posted on

Getting Started with AWS RDS: Create, Connect and Query a MySQL Database in the Cloud

Hello Devs,

In this guide I am going to take you step by step from scratch on how to create a Relational Database Service on AWS, connect to it and query it using MySQL Workbench.

But before we dive into the console and start clicking buttons, we are going to take a step back and understand the foundation — what data is, how it is categorised, and why a managed service like AWS RDS exists in the first place. Because understanding the why behind a tool makes you a far better engineer than just knowing the how.

By the end of this guide you will have a fully functional cloud database running on AWS that you can connect to and query from your local machine — the same foundation used in real production environments.

Prerequisites

As we get started, make sure you have the following:

An AWS Account — a free tier account is perfectly fine for this tutorial

MySQL Workbench — the GUI client we will use to connect to and query our RDS instance. You can download it free from the official MySQL website (https://dev.mysql.com/downloads/workbench/)

Basic SQL knowledge — if you have never written a SQL query before, do not worry. We will walk through everything step by step

What is Data?

Data is any recorded fact, measurement, or observation that represents something that happened in the real world — taking a picture, recording a video, a user signing up to a website or an application, a payment being processed, a product going out of stock.

Every action, digital or physical, generates data, and that data needs to be captured, stored, and retrieved reliably.

Take an e-commerce platform. When you visit a site like Amazon, you browse through products, find what you want, and hit buy. That single click triggers a chain of events: an order is created, your payment is processed, your delivery address is captured, and the product's stock count drops by one. All of that is data.

Ever wondered where that information actually goes after you complete a purchase? That is where databases come in.

What is a Database?

A database is simply a structured way to store data so it can be retrieved, managed, and updated efficiently. Think of it as the filing system behind every application you use.

As an organisation or individual, you have two broad categories of data to worry about — and each one demands a different storage approach.

Unstructured Data

Unstructured data has no predefined format. Images, videos, audio files, PDFs — none of these fit neatly into rows and columns. For this type of data, you reach for object storage:

  • Amazon S3 (AWS)
  • Google Cloud Storage (GCP)
  • Azure Blob Storage (Microsoft)

These services are designed to store and serve large binary files cheaply and at massive scale. They are not designed for querying relationships or enforcing data integrity.

Structured Data

Structured data has a defined shape — it lives naturally in tables, with rows and columns. Think of a spreadsheet, but with strict rules, relationships between tables, and the ability to query across millions of records in milliseconds.

For this, you need a relational database. Some of the most widely used options are:

  • MySQL — open source, battle-tested, widely supported
  • PostgreSQL — open source, highly extensible, excellent for complex queries
  • MariaDB — a community fork of MySQL with additional features
  • Microsoft SQL Server — enterprise-grade, deep integration with the Microsoft ecosystem
  • Oracle Database — feature-rich, common in large enterprises and financial institutions

These engines give you SQL, ACID compliance, foreign keys, joins, and everything else you need to manage relational data reliably.

So Where Does the Problem Come In?

Running any of these databases yourself — on your own server or a cloud VM — means you are responsible for everything:

  • Installing and configuring the engine
  • Applying security patches and version upgrades
  • Setting up automated backups and recovery
  • Configuring replication for high availability
  • Scaling storage as your data grows
  • Monitoring performance and troubleshooting slow queries

That is a significant operational burden, especially for teams whose core focus is building a product — not managing database infrastructure.

Enter AWS RDS

Amazon Relational Database Service (RDS) is AWS's fully managed database service. The idea is straightforward: you choose your database engine, AWS handles the infrastructure.

RDS supports all the major engines you already know:

  • MySQL
  • PostgreSQL
  • MariaDB
  • Oracle
  • Microsoft SQL Server
  • Amazon Aurora — AWS's own MySQL and PostgreSQL-compatible engine, engineered for higher performance and availability.

With RDS, AWS takes care of backups, patching, failover, replication, and scaling — while you connect to your database the exact same way you always would, using a standard connection string and your existing SQL queries. Nothing changes in your application code.

What RDS Actually Gives You

Automated backups — RDS continuously archives your transaction logs and takes daily snapshots, enabling point-in-time recovery to any second within your retention window.

Multi-AZ deployments — RDS can maintain a synchronous standby replica in a separate Availability Zone. If your primary instance goes down, AWS automatically promotes the standby and updates your endpoint — typically within 60 to 120 seconds, with no changes required on your side.

Read replicas — For read-heavy workloads, you can spin up replicas that absorb reporting, analytics, or search queries, reducing load on your primary instance.

Storage auto scaling — RDS monitors your available storage and scales it automatically when you approach capacity. No manual intervention, no outage.

Security — Your database lives inside a VPC, never exposed to the public internet by default. Encryption at rest and in transit is supported out of the box.

What We Are Building Today

Now that you understand what RDS is and the problem it solves, it is time to get our hands dirty. Here is what we are going to do:

Phase 1 — Create an AWS RDS Instance

Phase 2 — Configure the Security Group

Phase 3 — Grab the Database Endpoint

Phase 4 — Connect to the Database Using MySQL Workbench

Phase 5 — Query Data

Phase 1. Creating an AWS RDS Instance

Step 1 — Log Into the AWS Console

The first thing before we get our hands dirty you need to have an aws account so go to console.aws.amazon.com and sign in to your account if you dont have ann account you acn create a free acoount here https://aws.amazon.com/free/.

Once logged to your account you will be able to see your aws console.
aws-console-image

Step 2 — Navigate to Databases

Once inside, using the search bar at the top, type RDS,

You will be abale to see different AWS relation database system services, to create an RDS database we are going to select Aurora and RDS service.

So click on Aurora and RDS service.

database-navigation-step

Step 3 — Choose a Creation Method

Once inside the RDS console, you will be taken to the Aurora and RDS Dashboard. On the left-hand sidebar, click Databases.

To create a new database, click the Create database button in the top right corner. A dropdown will appear with three options:

  • Express configuration — the quickest setup, AWS makes most decisions for you
  • Full configuration — gives you complete control over every setting from engine to networking
  • Restore from S3 — used to restore an existing database from a backup stored in S3

For this tutorial, select Full configuration so you understand exactly what you are configuring and why each setting matters.

creation-method

Step 4 — Select Your Database Engine

First we have to select a Database engine we are going to use. AWS gives you a wide variety of Database engines to select from.

In this tutorial we are going to work with MySQL database Engine.

Select MySQL.

database-engine
Below the Engine select Full configuration so we understand every setting we are working with.

full-confuguration-option

Step 5 Choosing a Template

The next section is Templates. You have three options for this tutorial we are goinf to use Sandbox — for gaining hands-on experience with Amazon RDS

chosing-a-tamplate

Step 6 Availability and Durability

This section shows your Deployment options. There are three:

  • Multi-AZ DB cluster deployment (3 instances) — creates a primary instance with two readable standbys in separate Availability Zones. Provides 99.95% uptime, redundancy, increased read capacity and reduced write latency.
  • Multi-AZ DB instance deployment (2 instances) — creates a primary instance with one non-readable standby in a separate Availability Zone. Provides 99.95% uptime and redundancy
  • Single-AZ DB instance deployment (1 instance) — a single database instance with no standby. Provides 99.5% uptime and no data redundancy

For this tutorial select Single-AZ — it is the simplest and most cost effective for learning purposes.

Availability-and-durability

Step 7 Settings

Under the Settings section you will configure the following:

Edition — leave this as MySQL Community

Engine version — this defaults to the latest stable version, currently MySQL 8.4.8. Leave it as it is.

DB instance identifier — this is the name of your database instance. Replace the default database-1 with something meaningful, e.g. my-first-rds

settings

Step 8 Credentials Settings

Under the credentails setting we need to fill in the credentials we will use to connect to our instance.

Master username — this defaults to admin. You can leave it or change it to a username of your choice. This is the login ID you will use to connect via MySQL Workbench.

Credentials management — you have two options:

  • Managed in AWS Secrets Manager — AWS generates and manages your password automatically. Note that this incurs additional charges
  • Self managed — you create and manage your own password

For this tutorial select Self managed so you have direct access to your password for the MySQL Workbench connection.

Set a strong password and confirm it. Keep this somewhere safe — you will need it to connect.

Under Additional credential settings, Database authentication options, leave it as Password authentication.

credentials-settings

credentials-settings2

Step 9 Instance Configuration and Storage

Under Instance configuration, you will see three class types:

  • Standard classes (includes m classes) — general purpose
  • Memory optimised classes (includes r classes) — for memory intensive workloads
  • Compute optimised classes (includes c classes) — for compute intensive workloads

Select Standard classes and change the instance type to db.t3.micro from the dropdown — this is the smallest and most cost effective option suitable for this tutorial.

instance-configuration
Under Storage:

  • Change the Storage type from Provisioned IOPS SSD (io2) to General Purpose SSD (gp2)
  • Set Allocated storage to 20 GiB
  • Disable the auto scalling feature under the Additional storage configuration as we dont need it for this tutorial

This keeps your costs low for a learning environment.

storage-allocation

Step 10 Connectivity

This step is the most important — it controls how your database is accessed.

Compute resource — leave this as Don't connect to an EC2 compute resource. We are connecting from our local machine via MySQL Workbench, not from an EC2 instance.

Virtual Private Cloud (VPC) — leave the Default VPC selected. You can also create a VPC if you dont want to use the default VPC.

Note that you cannot change the VPC after the database is created.

DB subnet group — leave as default

Public access — set this to Yes. This is critical. Without public access enabled, MySQL Workbench on your local machine will not be able to reach the database.

connectivity
VPC security group — select Create new and give it a name e.g. rds-mysql-sg. This acts as a firewall controlling which IP addresses can connect to your database.

Availability Zone — leave this as No preference.

Leave RDS Proxy unchecked and the Certificate authority as the default.

vps-connection
Expand the Additional configuration section. You will see one setting here:

Database port — this defaults to 3306. Leave this as is. When we later configure MySQL Workbench to connect to our RDS instance, it will use this exact port number to communicate with the database.

database-port

Step 11 — Monitoring

Under Monitoring you will see two options:

  • Database Insights - Advanced — retains 15 months of performance history, fleet-level monitoring, CloudWatch integration
  • Database Insights - Standard — retains 7 days of performance history

For this tutorial select Database Insights - Standard to avoid unnecessary costs.

Under Additional monitoring settings you will see Log exports — these allow you to publish logs to CloudWatch:

  • Audit log
  • Error log
  • General log
  • IAM DB auth error log
  • Slow query log

Leave all of these unchecked for now. They are useful in production but not needed for this tutorial.

monitering

Step 12 Additional Configuration

Expand the Additional configuration section. This is where you configure database options, backups, encryption, maintenance and deletion protection.

Database options

Initial database name — this is important. Type a name for your first database e.g. myrdsDB. If you leave this blank, AWS will create the RDS instance but will not create a database inside it, meaning you will have to create one manually later.

DB parameter group — leave as default.mysql8.4. This contains the default configuration parameters for your MySQL engine.

Option group — leave as default:mysql-8-4. Leave this as default.

Backup

Enable automated backup — this is unchecked by default in the Sandbox template. For this tutorial leave it unchecked. In a production environment you would always want this enabled as it creates point-in-time snapshots of your database automatically.

additional-configuration
Enable encryption — this is checked by default. ⚠️ Uncheck this for the tutorial. The Sandbox template in a free tier account may not have the required KMS key pre-configured or your IAM user may not have sufficient permissions to use it, which will cause your database creation to fail with a KMS permissions error.

Note:

In a real production environment you would always want encryption enabled. Encryption protects your data at rest — meaning even if someone gained access to the physical storage, they could not read the data without the encryption key. For this tutorial it is safe to skip it.

Maintenance

Enable auto minor version upgrade — leave this checked.

Maintenance window — leave this as No preference.

Deletion protection — leave this unchecked for this tutorial. In production you would always enable this — it prevents the database from being accidentally deleted. Since we may want to delete this instance after the tutorial to avoid charges, we leave it off.

maintenance

Step 12 — Create the Database

Upto this point we have the required configurations to create out database.

Scroll to the bottom and click Create database. AWS will begin provisioning your instance — this typically takes 5 to 10 minutes. The status will show as Creating and change to Available once it is ready.

create-the-database

one-hour-later

Step 13 — Database Created Successfully

After clicking Create database, AWS will begin provisioning your RDS instance. This typically takes 5 to 10 minutes.

You will be redirected to the Databases console where you will see your database listed with a status of Creating. Do not close this page — simply wait while AWS provisions your instance in the background.

Once the process is complete, a green success banner will appear at the top of the page confirming that your database has been created successfully. The status of your database will also change from Creating to Available.

database-create-success

Phase 2. Configure the Security Group

At this point you have successfully createded out RDS.

Before we can connect to our database from outside AWS, we need to open the right door. This means adding an inbound rule to our security group to allow traffic on port 3306 from our local machine's IP address.

Click on your RDS instance you have just created to open the instance detail page. This is where you can see all the information about your database including its status, endpoint, port, and security settings.

Once inside, scroll down and click on the Connectivity & security tab.

congig-security-group

Scroll down to Security group rules , you will the able to see security group for both outbout and inboud traffic.

Click Edit inbound rules security group.

inbound-security-group
This will redirect to an the security inbound security group , click on the Security group ID.

security-group
This will open the details page for security group with for that ID, on this page click the Edit inbount rules.

edit-security-groups

  1. You will land on the Edit inbound rules page. This is where you control what traffic is allowed to reach your database. You will see the following columns:
    • Type — the type of connection. Set this to MySQL/Aurora
    • Protocol — this will automatically be set to TCP. Leave it as is
    • Port range — this will automatically be set to 3306, which is MySQL's default port. Leave it as is
    • Source — this controls which IP addresses are allowed to connect. You will notice it is currently set to Anywhere (0.0.0.0/0)

⚠️ Important: Setting the source to Anywhere (0.0.0.0/0) means your database is reachable from any IP address in the world. This is fine for a tutorial environment but in production you should always restrict this to My IP — your specific IP address only — to prevent unauthorized access to your database.

For this tutorial leave it as Anywhere so you do not run into connection issues, then click Save rules.

edit-security-bounds

edit-security-bounds-success

Phase 3. Grab the Database Endpoint

Next, we need to grab our database endpoint and credentials from the RDS console. These are the details we will use to establish a connection from MySQL Workbench to our live RDS instance.

Go back to the RDS console and click on your database instance to open the instance detail page.

Click on the Connectivity & security tab.

Under this tab select Endpoints oprion to get the connection details we are going to use with MySQL Workbench.

Scroll down to the Endpoint & port section you will see something that looks like this:

my-first-rds.xxxxxxxxxx.us-east-1.rds.amazonaws.com

endpoints
This is your endpoint — think of it as the address of your database in the cloud. Just like you type a URL into a browser to reach a website, MySQL Workbench will use this endpoint to reach your RDS instance.

Copy this endpoint and keep it somewhere handy — along with the following details you configured earlier:

  • Endpointyour-instance.xxxxxxxxxx.us-east-1.rds.amazonaws.com
  • Port3306
  • Usernameadmin
  • Password — the password you set during creation
  • DatabasemyrdsDB

These five pieces of information are everything MySQL Workbench needs to establish a connection to your live RDS database.

Phase 4. Connect to the Database Using MySQL Workbench.

Now that we have our RDS database on stand by with the credtails required to connect to it ready.

Open your MySQLI workbench application.

If you having pproblems on the instanlation Please follow the youtube guide below.

https://www.youtube.com/watch?v=u96rVINbAUI

Click on the + button next to MySQL Connections.

Open MySQL Workbench and click the + icon next to MySQL Connections to open the Setup New Connection dialog. Fill in the fields as follows:

connection
This will open a pop-up that will allow us to enter the connection credentials we saved.
connection-fiends

Connection Name — give your connection a recognisable name e.g. my-first-rds. This is just a label so you can identify it later.

Connection Method — leave this as Standard (TCP/IP). This is the standard way of connecting to a remote MySQL database over the internet.

Under the Parameters tab:

Hostname — this is where you paste your RDS endpoint that you copied from the AWS console. Replace the default 127.0.0.1 with your endpoint e.g.

my-first-rds.xxxxxxxxxx.us-east-1.rds.amazonaws.com

Port — leave this as 3306. This matches the port we configured on our RDS instance.

Username — replace root with admin — the master username you set during RDS creation.

Password — click Store in Vault and enter the password you set during RDS creation.

Default Schema — type myrdsDB — the initial database name you set during RDS creation.

Once all fields are filled in, click Test Connection to verify everything is working before clicking OK.

After the connection is etablished you will be able to see the my-first-rds database under connection click on it o open.

connection-successful
Your database will open successfully and you should see the interface as shown below.

database-interface

Phase 5. Query Data.

Now that our connection is successful, the last piece of the puzzle is querying our live RDS database.

This is where everything comes together — we will create a table, insert data into it and retrieve that data using SQL queries.

In MySQL Workbench, click on your my-first-rds connection to open it. You will land on the SQL editor where you can start writing and executing queries directly against your RDS instance.

Create a Table

The first thing we need to do is create a table to store our data. Let's create a simple users table:

CREATE TABLE users (
    id INT AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100),
    email VARCHAR(100),
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
Enter fullscreen mode Exit fullscreen mode

Select the query and press Ctrl + Enter (or click the lightning bolt icon) to execute it.
table-creation

Insert Data

Now let's insert some records into our users table:

INSERT INTO users (name, email) VALUES
('John Doe', 'johndoe@email.com'),
('Jane Smith', 'janesmith@email.com'),
('Bob Johnson', 'bobjohnson@email.com');
Enter fullscreen mode Exit fullscreen mode

Execute the query the same way. You should see a success message in the output panel at the bottom confirming the rows were inserted.

adding-details-to-the-DB

Query the Data

Now let's retrieve the data we just inserted:

SELECT * FROM users;
Enter fullscreen mode Exit fullscreen mode

This will return all the rows in your users table. You should see your three records displayed in the results panel — name, email and the timestamp of when they were created.

results

Summary

At this point we have successfully put the puzzle together.

We started from understanding what data is, walked through the different ways to store it, and landed on AWS RDS as our managed solution for structured relational data.

You now know how structured data can be stored in an RDS instance with a MySQL engine — from provisioning the database on AWS, configuring access, connecting via MySQL Workbench, all the way to creating tables and querying live data in the cloud.

Where we have reached should not be your limit. Go ahead and run more SQL commands, create more tables, define relationships between them and query your data in different ways. Just make sure to have a clear design of your database tables and their connections before you start building — a well thought out schema saves a lot of headaches down the road.

Congratulations — you have just set up and queried a live cloud database on AWS. 🎉


Cleanup

‘tis important to delete your RDS instance to avoid being charged by AWS. Even on the free tier, leaving resources running beyond the free tier limits can incur unexpected costs.

Here is how to clean up everything we created:

Step 1 — Delete the RDS Instance

  • Go to the AWS console and navigate to RDS
  • Click on Databases in the left sidebar
  • Select your database instance my-first-rds
  • Click Actions then Delete
  • AWS will ask if you want to create a final snapshot before deletion. For this tutorial select No and uncheck the acknowledgement checkbox
  • Type delete me in the confirmation box and click Delete

Step 2 — Remove the Connection in MySQL Workbench

  • Open MySQL Workbench
  • Right click on your my-first-rds connection
  • Click Delete Connection
  • Confirm the deletion

⚠️ Note: Once you delete your RDS instance the data inside it is gone permanently unless you created a snapshot. Always make sure you no longer need the data before deleting.

Top comments (0)