Before you go, check out these stories!

0
Hackernoon logoWhy did I decide to use Amazon Relational Database Service(RDS) in my project? by@doyanaydun

Why did I decide to use Amazon Relational Database Service(RDS) in my project?

Author profile picture

@doyanaydunDoğan Aydın

I have been using AWS(Amazon Web Services) services for more than 5 years, EC2 has been the service I have used the most in Amazon Web Services. I have developed many web based applications and services running on EC2 so far. Since EC2 comes with its own configuration, developers miss out to use RDS. What I mean, let’s say you want a windows server including IIS, SQL Server. You probably open EC2 interface, click “Launch Instance” button and select one image(AMI), then you use the server sometime as a standalone database or as both a web service and a database. That is the main reason why it isn’t so popular.

I needed to research RDS due to some reason a while ago and after this research, I realized that RDS is another awesome service provided by Amazon. You could ask “How could it be an awesome service, that is a just relational database?” If you had asked, you would have been wrong. Let’s dive into the features of it.

Let’s summarise how awesome it is, first:

  • No infrastructure management
  • Application compatible
  • Secure
  • High available
  • Scalable (up/down)
  • Easy monitoring
  • Backup restore capability
  • Perfect API abilities
  • Cost effective

It’s strange but it’s true, fully managed host and OS. You don’t know which OS are running under the DB or how host it is. Therefore, there is no access to the database host operating system. If you just uses the database and you aren’t an expert on the database, it’s probably an DB expert knows more than you how OS configuration should be. Amazon experts, who have high level expertise on both OS and DB, configure the system configuration by considering performance, security, fault-tolerant. So, no functions that rely on configuration from the host OS. The system comes as a ready-to-use solution.

AWS RDS is a service name not a database name. It means, RDS is more than a database, it supports different types of database. PostgreSQL, MySQL, MariaDB, Oracle, Microsoft SQL Server and Aurora are supported today. You could say that OK, I know them but what the hell is this Aurora? Aurora is a database developed by Amazon. They didn’t spend its time not only for developing RDS but also developed its own database. According to its official web site, it provides up to five times better performance than MySQL. Isn’t it interesting?

Either one of these 5 databases or Aurora could be selected. It’s not the topic of this post so I am not going to mention about details of databases. However, one thing it’s interesting for me and I would like to share it with you.

Max storage limits — TeraByte

  • SQL Server: 4 TB
  • PostgreSQL, MySQL, MariaDB, Oracle: 6 TB
  • Aurora: 64 TB

Do you see the gap? 16 times larger than SQL Server, more or less 11 times larger than others. If you do max out the storage, you should select a strategy like sharding strategy, archive strategy or delete strategy to handle new data. It seems that it is hard to reach the max limit of Aurora. Amazon shows its different, again.

Security

Security is another important topic. Amazon is solving this issue with its VPN(Virtual Private Network) ability, security group system, KMS(Key Management Service) and IAM(Identity and Access Management) service.

These services are also used in other AWS services due to its modular architecture. Since I don’t want to spread too many parts, I am not going to mention about them. However a video on youtube I watched regarding security group and I was impressed. The presenter said “Security groups are basically a firewall, a virtual firewall, that control protocol of traffic, range of ports, type of traffic, source of traffic and IP address of source.” It’s true. I have been using AWS security groups for more than 5 years, whereas I haven’t never realized that. It’s a virtual firewall.

As you haven’t gotten involved in a payment project, you might haven’t realized the importance of being PCI/DSS compliant. Taking a PCI/DSS compliance certification is a tough, complex and time-consuming process. However Amazon makes it easier for you at least for server perspective. You could mark server questions as OK in PCI/DSS compliance check list.

Being secure or PCI/DSS compliant don’t address directly to RDS. AWS common services provide such good features that we can use them with RDS.

Let’s talk more related with RDS and its abilities.

High Availability

There are two approaches regarding availability. First is minimal deployment that called single AZ. By the way, when I saw AZ term in Amazon RDS web site, I lived a hard time to understand what it means. AZ means “Available Zone”.

Minimal Deployment looks like;

Single AZ

1 volume for data, 1 database instance for DB’s operation. The database should be up and available at any time. It’s obvious, running a single availability zone deployment may not be the best approach.

Second, High availability. It looks like;

Multi AZ

Doesn’t it look more complicated, right? Two same DB instances run on different zones. Data volume is a replica of one other. If there is a network communication issue or an actual failure with the primary zone, it gives you an option to have something else to failover to minimize the amount of downtime.

When there’s a failure with that master database or the availability zone that it’s in the RDS service will take over because it’s a managed service and will repoint that DNS entry to your standby database and make that standby database your primary master database now.

The good thing is that you don’t care any of these processes. RDS handle it for you. Just you need to say to RDS, open multi AZ and the number of zone you want to run DB.

Scaling

Your web site or mobile application become more popular or more widely used and you have a master DB that is getting a lot of pressure not only supporting “write” operations but also supporting a lot “read” operations. In this case, you might want to divide the load to separate servers.

One approach is that you could add same additional replica database to help take some of load off. Master database and its replicas can be used for “read” operation, whereas just master database is used for “writing” operation.

Different reasons why you might want to scale your database up or down. Obviously, first one is handling a higher load, the other option is lower usage. You may size your initial database to handle what you expect to be a certain number of transactions, a certain number of users and you might find later that you aren’t hitting those numbers and the DB is quite underutilized. You might want to scale your database down.

One other option is time-dependent usage. Let’s say you have an application with a database that are very heavily used Monday through Friday but on the weekend it’s barely used at all nobody touches. Wouldn’t it be great if you could actually resize that DB down to a smaller size.

You might use RDS web interface to scale the server up or down, whereas Amazon also provide ways in order to scale the server automatically. AWS CLI(Command Line) and API. You might prepare a cron(unix scheduled job).

CLI commands look like;

CLI — Scale Up
CLI — Scale Down

One line of code for scaling up or down. What an awesome thing, ha!

Detail:http://docs.aws.amazon.com/autoscaling/latest/userguide/schedule_time.html

Cron look like;

Cron

Detail: http://docs.aws.amazon.com/cli/latest/reference/autoscaling/put-scheduled-update-group-action.html

You might ask that I need one more server so that the server can run this cron. As the cron server runs, I will pay for it also. Well, where is the cost cutting? You are right but amazon comes with an other service to run this cron. Lambda, no server but still on a schedule! AWS Lambda lets you run code without provisioning or managing servers. Write your code on cloud, run on cloud.

Last one, RDS provides metrics-based scaling, as well.

  1. RDS is feeding into CloudWatch
  2. Define your alarm thresholds
  3. Once those thresholds are crushed, an alarm is created.
  4. It sends a notification as SNS(Simple Notification Service)
  5. You could subscribe a Lambda function that can take action on your DB if you feel like you need to scale up based on the threshold that you defined.

RDS includes many additional features such as taking backup, restoring, monitoring. I tried to write the most importance those I care.

After all, Oscar goes to Amazon, thanks Amazon.

Best,

Doğan Aydın

Linkedin Profile: https://www.linkedin.com/in/doganaydin/

GitHub Profile: https://github.com/trda

Tags

Join Hacker Noon

Create your free account to unlock your custom reading experience.