Cloud Databases Made Simple: Creating Your First AWS RDS Instance

,

I recently started full time learning of Amazon Web Services (AWS). I found that AWS's Relational Database Service

(RDS) is really user-friendly.

RDS simplifies many of the

complicated aspects of database setup, operation, and scaling. Now that

I've gone through the process myself, I'm here to walk you through

setting up your first AWS RDS instance.

Let's break it down into simple

steps so you can get your cloud database up and running in no time.

What is RDS?

AWS RDS (Relational Database Services) is a managed relational database service, where you can choose multiple database engines (MySQL, PostgreSQL, MariaDB, SQL Server, Oracle, DB2)

Since it is managed, with a couple of configuration options, you are ready to go and start using it on your application.

It is highly scalable, so you do not need to know how much resources to provision upfront, as you can scale it as your storage or computing requirements increases.

It offers automated backups, point in time recovery and multi Availability Zone so you can have DR and HA ready to go.

It is highly secure as you can encrypt data at rest and in transit. With the proper configuration of VPC, you can isolate it at network level. Also with the help of Guarduty you have threat detection feature available.

Common use cases include: Web applications, E-Commerce, Blog and news sites, and any other general-purpose application requiring a reliable, globally available, and scalable database.

 

Prerequisites

 To use it, you will need an AWS account,  if you don't have one you can create one here.
Basic AWS knowledge is required as you need to understand what IAM is and how VPC works.
also some prior database knowledge is required as we will assume you know about the DB engine you are creating.
Once you have your account created, there are multiple ways to create your database: Web console, AWS CLI, IaC, CI/CD pipelines, etc.
For this post, we will use AWS console, you can access it here
Note: It is recommended to create another IAM user different from the root account and enable MFA. Root account should not be used for day to day work and implementations.

Which engine to choose?

RDS support multiple database engines, so it depends on multiple factors: your needs, your knowledge and your budget, In all cases if you need a migration from on premises, then you can choose the same engine to make the migration easier.
MySQL and PostgreSQL are open source databases, and if needed you can jump to RDS aurora if you need a more scalable and faster database.
SQL Server, Oracle and DB2 are proprietary databases, so it could be more expensive, but if you have previous knowledge on those engines, or you have regulatory constraints on not use open source technologies, you can opt for those.
MariaDB is an open source database based on MySQL, so it could be a modern approach if your application will be developed from scratch.
Aurora is the AWS implementation for RDS, it can perform better compared to other engines. It is offered in two modes: MySQL and PostgreSQL, since is optimized for AWS can perform and escalate better than their raw counterparts, it also offers unique features like Global Database and Zero-ETL. One drawback (at the moment of the writing of this post) is that is not available in free tier.
Since we are learning and we do not want to incur on high costs, for this example we can use MySQL or PostgreSQL (not Aurora).

Free tier

 RDS offers a free tier during the first 12 months after your account creation with the following restrictions:
  • 750 Hours of Amazon RDS Single-AZ db.t2.micro, db.t3.micro, and db.t4g.micro instances usage running MySQL, MariaDB, PostgreSQL
  • 20 GB of General Purpose (SSD) database storage
  • 20 GB of storage for database backups and DB Snapshots

Any additional cost will be charged at standard rate.

You can always forecast your costs using AWS pricing calculator.

 

Creating our first AWS RDS Instance

In the AWS console, in the search bar, type RDS, then select the RDS service.
On the new page, click on Create Database:

I will guide through all options available, so choose Standard Create.

Then select the engine you want, for our example we will use MySQL.

 

 

Select the Edition and the required version, in most cases you will select the latest version available.

 

For Template, we will select the Free Tier.

You can see that the deployments options are locked to single DB instance, if you want to configure a highly available database, you need to select a Dev/Test or Production template.

 

For the settings, put the instance name you want (note, this instance name can contain multiple databases)

Then select the options for the credentials you want. It is advisable to use AWS Secret manager, but we do not want to incur in additional costs, so we will use a manual password.

 

 

For Instance configuration, you select the size of your instance based on the expected workload, note that for free tier the options available are limited.

You can learn more about instance types here.

 

 

For storage options, you put the expected values for your db size, notice that for free tier we must select gp2 type.

We have disabled storage auto scaling so we do not incur on additional costs by mistake.

If you want to learn more about RDS storage configuration, you can check here.

 

 

In Connectivity, select the parameters you need if you need a connection with an EC2 instance, and the VPC you want to use.

I previously created a VPC for my database but you can use the default or another one you want.

Note that you cannot change your VPC later.

 

 

Choose the DB sub-net group to use, or create a new one.

In public access, i will select Yes so I can show you how to connect from my local machine, but is highly advisable to not grant public access to your database and use VPC and security groups instead to connect to it.

We will not use RDS proxy to maintain our costs low, basically RDS proxy is used to connect client applications to the database in a high available and resilient proxy managed by AWS.

 

 

Configure the CA to use and the database port.

We will leave the default for our example.

 

 

We will not enable enhanced monitoring for our example.

Then select the database name you need, or you can leave it blank and create a new database later.

we will use the default parameter group and option group, the parameter group is where the instance level options are configured for each DB engine, those parameters are engine-specific.

We also enable Automated backups since we have 20 GB available on the free tier.

 

 

We configure some additional backup options as well as encryption (always recommended).

 

 

For log exports, in production environments, I recommend to select all, for non prod or test environments, is up to you which logs to capture.

Note that CloudWatch charges you based on the storage needed to save the logs.

 

 

Once everything is configured, we will see the estimated costs based on our selections, you can go back at this point and change anything you need.

You can see with the options we selected, we are under the free tier.

Once you are happy with your configuration click on Create Database.

 

 

The provision on your resource will take some minutes or more based on the configuration options you choose.

For large setups, with clustering, replication and large storage, it could take a considerable time to complete.

 

 

Once your instance is ready, you can access it under Databases.

You will see it as status Available if is ready to use.

 

 

 

Connecting to our instance

There are multiple options to connect to the instance and start using it, but the easiest mode is using the connection endpoint and port.

Since we configure our instance to be public, we can connect from my local machine.

You can obtain the endpoint and port in the Connectivity & Setup tab:

 

 

To connect to your instance, it depends on the engine you choose, but since I am using MySQL, I will use MySQL Workbench, it is free and you can download it from here.

Other options include Azure Data Studio or VSCode with its proper extensions.

In MySQL Workbench, create a new connection:

 

For Connection Name, put a descriptive name.

Then put the endpoint as host name and the port you configured.

for the initial connection, put the username and password we configured earlier, but is advisable to create another user right after.

Click on Test connection, if you can reach the instance, you will be asked for password.

NOTE: If you cannot reach your instance, please check your VPC setup.

 

If everything is ok, the connection test will be succesful:

 

 

You can see the DB we created earlier, now you are good to go, we can test creating a simple table:

 

 

 

We have validated our access is ok.

We are good to start working inside our new instance:

 

 

Dropping the instance

To make sure you don't leave the DB running and start seeing charges in 12 months, you can delete the database using the Delete option in AWS console.

Please don't do this for prod instances, this is just in case you are testing and experimenting with RDS.

 

 

What to expect next?

That's it—your first AWS RDS instance is up and running! You've tackled the basics of setting up a RDS instance, and now you're ready to explore further.

As you continue your journey with AWS RDS, remember that learning is ongoing. Keep experimenting, asking questions, and seeking out resources to deepen your understanding.

Thank you for reading this long post, and please keep in touch, as in the next posts we will explore about monitoring, performance and troubleshooting common issues.

 

Original post (opens in new tab)

Rate

You rated this post out of 5. Change rating

Share

Share

Rate

You rated this post out of 5. Change rating