| devops - Jon Welling
What is Amazon RDS and How It Works
All applications need a way to store data. App developers can store data in individual files, but this can be inefficient and rather cumbersome. So, databases tend to be the preferred method for data storage. Of course, databases come with other benefits, too. They aren't just good at storing data.
Building and managing database services for applications can be a chore by itself, though. These are extra systems that need to be built, maintained, and secured — on top of the application itself. Thankfully, we live in an age where services like managed databases are readily available. In fact, Amazon, a leader in the cloud computing space, offers a relational database service called Amazon RDS.
Let's look at what Amazon RDS is, what it offers, and why you should use it.
What is Amazon RDS?
Amazon RDS is AWS's relational database service. It's a fully managed relational database. There are many different types of databases. Very broadly speaking, database engines are either relational or non-relational. Of course, there are other types of databases, but they tend to be used for very specific use cases. Relational and non-relational databases are more commonly used for applications.
An example of a relational database would be MySQL, Postgres, or MariaDB. The most popular non-relational database is Mongo followed by Redis, though Redis is typically used for cache and not long-term data storage.
A Overview of Amazon RDS [VIDEO]
In this video, Bart Castle covers getting started with Amazon RDS. This video is largely theoretical — Bart’s focusing on the broad concepts of relational data and data storage, and how Amazon RDS fits into that equation.
Why Use Amazon RDS?
The primary reason to use a database is to store data. Relational databases are the perfect tool for storing organized data. Let's discuss that a bit further.
Most applications only work with specific data sets. For example, if you are building a point-of-sale application for a grocery store, you need to know what types of foods that grocery store has, the product number (or SKU) of each item, the cost of that item, and how many units of each item the grocery store has at any given time. Your application couldn't care less about the air-speed velocity of an unladen European or African swallow. That isn't data that you need.
Relational databases are the perfect storage mechanism for this type of related data. As an application developer, you understand what kind of data is being stored in that database. So, you can leverage the fact that the data in your database is all related and make a call to your database for a specific SKU to find a product's price.
That's one of the other benefits of a database. Database engines have built-in logic. This saves time and complexity while building an application. Though that logic can be limited, it can also be powerful. For example, it's very easy to make a call to a relational database, like Amazon RDS, to get all products that cost between $5 and $6. If you happen to store what products were purchased and when they were purchased in your point-of-sale system, it's very easy to make a call to your database to find out how many hotdogs were sold at your grocery store during the month of July.
Though you could program those functions into your application, it's much easier to let the database find that data for you. There's a good chance that a relational database like Amazon RDS will find that data much faster than your native code, too.
Amazon RDS Relies on Separation of Duty
There is another concept called Separation of Duty, too. This is nothing more than separating the responsibilities of an application out to different systems or services. That way an application doesn't become overburdened with all the tasks that need to be performed to keep it running.
Think of this like running a food truck. If your application did everything on its own, then it would handle taking the orders for that food truck, cooking food for those orders, serving the orders, prepping food, and cleaning the food truck at the end of the day.
So, what if you hired one person to take orders and serve them, another person to prep food early in the morning, and another person to clean the food truck at the end of the day. Without those extra people, you wouldn't be able to serve a lot of your patrons since you handle all of those responsibilities yourself. By hiring those extra people, and separating responsibilities, you can now handle a larger workload, serve more guests, and earn that much more money.
This is the concept behind using a managed service like Amazon RDS. You could create your own database. That is easy enough. By managing your own database service, though, you need to spend time and energy maintaining that database, securing it, and hosting it somewhere. With a managed service like Amazon RDS, you only need to worry about pushing data to and from the database and ensuring your data is normalized and accurate. Amazon RDS separates the duty of maintaining a database from your responsibilities as an app developer.
How Does Amazon RDS Work?
Amazon RDS is a fully managed relational database service provided by AWS. Because AWS leverages its data centers to offer so many products and computing power to consumers and businesses, it's able to offer RDS for a very affordable price.
Amazon RDS is built on top of the AWS EC2 platform. Essentially an Amazon RDS instance runs inside of a virtual machine on EC2. That brings all of the benefits of EC2 as well.
For instance, Amazon RDS instances are secure. Amazon uses its IAM policy system to control who has access to each RDS instance. IAM identities must be configured and deployed by the person requesting RDS services. So, in theory, only the persons that have those identities can access data stored in an RDS instance. Amazon handles all of the authentication and identity management of RDS instances for you.
Likewise, because RDS is built on top of EC2, that means they can be backed up easily. EC2 offers several backup options including regular snapshots. That can ensure that data is always safe and secure.
Building on top of that notion of security, traffic flowing to and from RDS can be filtered, too. If you only want your application or a specific IP address to access an Amazon RDS instance, that is very easy to configure.
Data can be encrypted at rest within Amazon RDS, too. You do have the option to select which relational database engine you want to use for your RDS instance. Some engines, like Microsoft SQL, can perform row-level encryption. Others can perform whole database encryption. Either way, data within the database itself can be encrypted. Likewise, because EC2 uses AWS EBS to store virtual machine data, the entire storage container can be encrypted, too. This is essential for any services that have to follow certain regulations like HIPAA or HITECH.
Because Amazon RDS is built on top of EC2, it can also be configured for high availability. Database instances can be replicated over multiple EC2 instances in different regions. That way if one instance becomes unavailable, the database service can fail over automatically to another instance of that database.
Amazon RDS is a managed relational database service built on top of AWS EC2. Because RDS is built on top of EC2, it has access to all of the same features as EC2 such as identity management, access control, IP and access filtering, automatic snapshots, and backups. Because Amazon RDS is a managed service, things like backups and updates are handled automatically for you.
Using a service like Amazon RDS fits nicely into the separation of duties model. Essentially, as an app developer, you don't want to worry about managing, securing, and building databases. You just want to worry about structuring them and using them to store data. By offloading the database administration to a managed service, you can handle more of a workload developing and administering your application instead.