A relational database is a collection of data items with a pre-set relationship between them. The data items could be organized in the set of tables built with columns and rows.
Relational database examples include standard databases i.e. Microsoft SQL server, Oracle Database, My SQL etc.
Nowadays, cloud-based relational databases or Database as a service are becoming a thing of the future as they enable companies to outsource the entire database maintenance & support to a RDS service provider. There are various Cloud players offering the RDS service i.e. AWS RDS, Google Cloud SQL, Microsoft SQL Azure, Oracle Cloud etc.
In this post we will focus on the AWS Cloud RDS service offered by Amazon.
Amazon RDS is a web service that enables the organizations to setup, operate & scale their relational databases in the AWS cloud.
AWS RDS service supports six flavors:
Benefits of using the Amazon’s RDS can be listed as below:
- Cost Effective: Since Amazon RDS is DBaaS, you pay for what you use. There aren’t any upfront cost involved. You have two purchasing options for RDS Instances:
- On Demand Instances: Pay per hour of the DB instance usage.
- Reserved Instances: You can opt for a 1 year or 3 year contract here. Upfront cost is involved but you get it at a discounted price as compared to On-Demand instances.
- Amazon RDS allows you to easily stop and start your database instances for up to 7 days at a time. This makes it easy and affordable to use databases for development and test purposes, where the database is not required to be running all of the time.
- Scalability: It makes it easy to scale up/down the capacity of your compute resources as per your applications need up to a max of 32 vCPU & 244 GB RAM. All this can be achieved with few mouse clicks or API calls.
- Availability: Amazon RDS supports automated backups. It backs up your DB & transaction logs so you can restore you DB instance to any second point in time. Backup retention period is 35 days.
- Administrative Ease: Within minutes launch & connect applications to DB instance. RDS instances are pre-configured with parameters & settings appropriate for engine and class you have selected. You can also integrate your RDS instance with Amzon CloudWatch at no additional cost & monitor the performance of your RDS instance including compute/memory/storage capacity, I/O activity etc.
- Security: RDS offers encryption at rest (AWS Key Management service) & encryption in transit (SSL is used) on your database. Backups/Snapshots of RDS instance are also encrypted.
AWS recommends having your RDS instance in your own VPC cloud to let it run in isolation & connect to your on premise Infrastructure using IPsec VPN tunnels.
Two key features of RDS are:
- Multi AZ – For disaster recovery
- Used when you want to spread your RDS across various availability zones.
- Failover is automatic with Multi AZ. Exact copy of your database is kept in another availability zone.
- Databases are replicated synchronously and AWS takes care of Replication.
- In case of primary DB failure the Amazon will simply update the DNS entry now to point to the backup DB in another availability zone.
- Read Replicas – For performance
- Used when you want to boost database performance.
- If you lose primary database you don’t failover automatically. It keeps replicating the Write operation of Primary DB to another database.
- It has benefit of scaling.
- If there is a high load on Primary database for Read requests you can point half EC2 instances to read from the replica and half from primary database.
- You can 5 replicas for read operations. Each read Replica will have its own DNS end point. You can have Multi AZ for read replicas.
- You can also create read replica of primary Multi AZ DB. Read replica can be promoted to be their own DB.
- In order to have read replica you need to have backups turned ‘ON’ on RDS instance.
- Read Replica can be in different region.
- SQL server doesn’t support read replica.