Amazon RDS or AWS RDS is a relational database service on AWS Cloud. The database is an integral part of most of the applications. MySQL and PostgreSQL are one of the database engines which are highly used. In order to run your application on AWS Cloud, you need a web service that supports the relational database. Amazon RDS is that service in AWS cloud.
What is Amazon RDS?
Amazon RDS is a highly scalable relational database service in AWS Cloud. It’s very easy to set up, scale, and operate a relational database like MySQL and PostgreSQL on the cloud. The service provides very easy to use and manage common database administration tasks. Amazon RDS is highly cost-efficient, resizable with industry standard relational database.
It takes over many of the difficulties that you face in traditional deployments. Let’s take a look at some of them:
- Amazon RDS manages the backup of your database automatically, You do not need to write scripts or cron jobs to do the backups.
- Unlike in a traditional database, you don’t need to take care of CPU, IOPS, memory, and storage, etc. If you need fewer IOPS, more CPU, or more storage, you can easily allocate them without hassle.
- You can use any database engine that you are familiar with like MySQL, PostgreSQL, Oracle, Microsoft SQL.
- You can get the high availability with master-slave architecture. You can use read replicas to scale up the read queries in MySQL, PostgreSQL, and MariaDB.
- You can control who can access your RDS database by using Identity Access Management(IAM) of AWS.
Why Amazon RDS?
There are several reasons to use Amazon RDS. Like any other service on AWS, RDS is also highly available, scalable, inexpensive, secure and easy to administer service. Let’s discuss a few of its benefits over traditional database setup and deployments:
1. Highly Scalable
You can scale your database storage and compute at any point in time. It takes very few steps to scale your database on AWS. You can also scale your database by creating the read replicas of your database. The primary database would always receive the write queries and all read queries will be handled by the read replicas.
Amazon RDS is built on the top of the AWS infrastructure and uses the same network as the other service. To enhance the reliability for critical databases running on production, Amazon RDS takes database snapshots including automated backups.
You only pay for what you use. Like any other service on AWS, Amazon RDS is inexpensive in comparison to the cost that you spend on traditional database setup.
If you are a beginner then you can use RDS with AWS EC2 instance of free tier i.e. t2.micro.
4. RDS Administration
It’s very easy to administer the RDS. The provisions of the database server and managing the instances is done by AWS. You can get your RDS instances setup and work in a few minutes. You can view the performance insights, take snapshot by just click of a button and AWS does the automated backups for you. Several other administrative tasks you can do with Amazon RDS.
5. Big RDS clients
Amazon RDS is one of the very popular and highly used services on AWS because of its benefits. Giants like Netflix and Expedia are using the RDS.
AWS RDS DB Engines
Amazon supports many database engines including its own database engine which is much faster than other engines. Most of them are very popular database engines that you have already used. Below are the engines which are supported by AWS:
- Amazon Aurora
- SQL Server
We will take an example for most of these engines to do the instance setup in our next posts.
Creating DB Instance in AWS RDS
Let’s create a DB instance using the AWS RDS. The best way to create an instance is from the AWS management console.
- Sign in to the AWS Management Console https://aws.amazon.com/console/
- Open the Amazon RDS console at https://console.aws.amazon.com/rds/. Also, make sure that you selected the correct region from right top dropdown.
- Click on the database in left navigation panel and you will see the below screen.
- Choose create database and select the DB engine. See below page for the reference.
- Let’s select mySQL as DB engine and click on Next button.
- The next step is to choose your use case. If you are creating database for production then choose “Production – MySQL”. We will choose “Dev/Test – MySQL” in this tutorial.
Now click on “next” button.
- Specify DB Details: This is setup page for your DB instance.
- License Model: License type associated with the database engine. MySQL has only license model general-public-license.
- DB engine version: Version of MySQL, we will select the latest available on AWS 8.0.15
- DB instance Class: Choose the DB instance class that allocates the computational, network, and memory capacity required by planned workload of this DB instance. We will select db.t2.micro – 1 vCPU, 1 GiB RAM.
- Select storage type as SSD and allocate storage as per your database size. Let’s select SSD as type and 20GiB storage.
- AWS will show you the monthly cost as per your selection. In our case below is the cost.
Note: If your account is eligible for free teir then there would be no cost.
- Add DB settings like user name and password.
Click on “Next” button.
- Now, Configure the advanced settings like network secuurity, database options, encryptions and backups.
- Network & Security: You can choose the default VPC and default subnet group for now. Read about AWS VPC for more understanding.
- Database options: Give the database name, port etc.
There are many other settings available to configure in RDS. We have selected most of the important configuration to launch our first database instance.
- Click on “Create Database”, AWS will take few seconds to create and then few minutes to configure and launch your first database instance on RDS.
Connecting to the AWS RDS Instance
Your DB instance is ready to be connected. Make sure that you remember the user name and password that you provided during the creation of DB instance.
You can connect the MySQL database as you usually connect. I will show you to connect from the console.
Please replace the endpoint, username, and password from your instance details. You can get these details from connectivity & Security. I cannot add screen here for security reasons.
deepak@localhost> mysql -h -P 3306 -u -p
You will see the below details upon successful connection.
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 200 Server version: 8.0.15-log MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql>