Amazon RDS

Abimuktheeswaran Chidambaram
8 min readJul 12, 2023

Amazon RDS is a relational database service managed by AWS. It supports various DB engines like Amazon Aurora, MySQL, MariaDB, Oracle, SQL Server, and PostgreSQL to store and organize the data. It helps to automate the tasks such as data migration, patching, Backup, and recovery.

Amazon RDS for MySQL supports the secure connection using the require_secure_transport parameter over SSL/TLS.

In this article we will discuss about the following chapters…

  1. Terminologies used in RDS
  2. Multi-AZ DB deployments
  3. Backup and Restore the DB instance
  4. Backup and Restore the DB Cluster
  5. Blue/Green deployments

1. Terminologies used in RDS

DB instance is a separate environment in the cloud. You can run one or more DB instances and each DB instance supports one or more databases and database schema depends upon engine type. It can be accessed by client tools and applications and also by stand-alone DB instances. Amazon RDS creates a master account for you when you create a DB instance. You can create the database and perform the following operations like create, delete, select, update, and insert operations on tables. You can change the master user password using standard SQL commands.

DB instance class determines the compute power and memory capacity for RDS instance.

DB Cluster is a collection of databases maintained by the instance or running DB server for connecting a database.

Maintenance Window in RDS is periodically to fix all issues of security and reliability in both hardware and software. It occurs once per week we may do it in a specific time period or schedule period. The time range from 30 mins — 23 hrs 30 mins.

Maintenance window

To learn more about the maintenance window click here

2. Multi-AZ DB deployment

Multi-AZ deployments can have one standby or two standby DB instances. In Multi-AZ the primary instance is created in one zone and the standby instance (secondary instance) is created in another zone. The data in the primary instance is replicated to the standby instance synchronously to avoid failover. Read Replica is the snapshot of the primary DB.

Deployment options

Multi-AZ DB Cluster deployment is a semi-synchronous, high availability deployment mode of Amazon RDS. It has 1 writer DB instance ( primary) and 2 reader DB instances (secondary or standby replica) in 3 AZs per AWS region. It provide failover support and can also serve read traffic. To prevent replication errors, all the tables should have a primary key. Multi-AZ DB cluster is only supported in MySQL and Postgre SQL DB engines.

Multi-AZ Cluster Deployment

Types of endpoints in Multi-AZ DB cluster

  1. cluster endpoint (or) writer endpoint have 1 writer DB instance that can perform write operations such as DDL and DML statements. This endpoint can also perform read operations such as queries. If the current writer DB instance of a DB cluster fails, the Multi-AZ DB cluster automatically fails over to a new writer DB instance.
  2. reader endpoint can perform read operations such as queries. By processing those statements on the reader DB instances, this reader endpoint reduce the overhead of the writer DB instance.
  3. instance endpoint connects to a specific DB instance within a Multi-AZ DB cluster. There is one instance endpoint for the current writer DB instance of the DB cluster, and one instance endpoint for each of the reader DB instances in the DB cluster.

Multi-AZ DB instance Deployment is a synchronous, high-availability deployment mode of Amazon RDS. It has one standby DB instance that provides failover support, but doesn’t serve read traffic.It uses a primary DB instance in one AZ, and a standby replica in another AZ. It supports data redundancy & minimizes latency on system backup and helps to protect the database against DB instance failure and AZ disruption.

Multi-AZ instance deployment

Amazon RDS uses failover technology for various DB engines (MariaDB, MySQL, Oracle, PostgreSQL, and RDS Custom for SQL Server DB instances) to provide failover support. For Microsoft SQL server instances it uses SQL Server Database Mirroring (or) Always on Availability Groups. To serve read traffic, you can use DB cluster or read replica, not standby replica.

Amazon RDS Reserved Instance used to reserve the DB instance for 1- 3 years. Amazon RDS Storage can store 64 tebibytes (TiB) per DB instance on MySQL, Oracle, PostgreSQL, and MariaDB and can store 16 tebibytes (TiB) on SQL Server.

Failover Process for Amazon RDS If the planned or unplanned outage (power or equipment or other services are not available at the period)of your DB instances results in an infrastructure defect. failover time typically occurs from 60–120 seconds. Amazon RDS handles the failover automatically and it switches from primary DB to standby replica to continue operations. It lists the following reasons in the event log.

  1. The primary host of Multi-AZ RDS is unhealthy.
  2. The primary host of Multi-AZ RDS can’t be reached due to network issues.
  3. The primary host of Multi-AZ RDS is busy and irresponsive.
  4. The primary host of Multi-AZ RDS detects storage issues.
  5. The primary host of Multi-AZ RDS in offline operation due to maintenance.
  6. Rebooted primary instance and choosing Reboot with failover.

3. Backup & Restoring DB instance

Amazon RDS Backup your entire database automatically backup according to the retention period that you specify. You can restore your database before the retention period expires. Choose the retention period fully to restore the automated backup after the retention period. . If you don’t want the database, after the retention period it will be deleted automatically. you can’t recover the deleted database.

Automated Backup If you want the automated backup for a longer time, copy it and create it as a manual snapshot. You enable automated backups by setting the backup retention period to a positive nonzero value (1,2,3). Once the Automatic Backup is turned on, database backup occurs daily. It follows the rule when performing a backup

1.The database must be in an available state.

2.Automated Backup does not occur while the DB snapshot is copying for the same database in the same region.

backup

Backup Retention Period: You can set the backup retention period when you create a DB instance or Multi-AZ DB cluster. The default backup retention period is one day if you create the DB instance using the Amazon RDS API or the AWS CLI. The default backup retention period is seven days if you create the DB instance using the console. The DB backup ranges from 7–35 days. The retention period deletes the automated backup in several situations like at the end of the retention period, disable the automated backup, and delete the DB instance.

Retention period

Cross Region Replication in RDS is used to replicate your backup in another supported region. For more details click here for supported regions. It is mainly used for disaster recovery and Business Continuity Plan (BCP) purposes.

Cross Region Replication

Snapshots

Creating DB snapshot Your DB instance must be in an available state to create the snapshot. creating the DB snapshot takes long time initially, because it backup the entire database. We can create DB snapshots in one region only. For very long-term backups of MariaDB, MySQL, and PostgreSQL data, AWS recommends exporting snapshot data to Amazon S3. Manual Snapshot don’t expire.

Copy the snapshot you can copy the automated backup or manual DB snapshot. After copying the snapshot, it becomes a manual snapshot. you can copy the snapshot within the same region or to a different region. You can copy the shared snapshot. You can copy the snapshot which is shared to you from any AWS account.

Copy the shared snapshot In some cases, you may copy an encrypted snapshot that has been shared from another AWS account. In these case, you have access to the AWS KMS key to encrypt the snapshot. You can copy the shared unencrypted DB snapshot to different region. You can copy the shared encrypted DB snapshot within the region.

Handling encryption while copying the snapshots Use the KMS key to copy the encrypted snapshot within the same region. To copy an encrypted snapshot across Regions, you must specify a valid KMS key in the destination AWS Region. It can be a Region-specific KMS key, or a multi-Region key. You can also encrypt a copy of an unencrypted snapshot. To do this, you want to create the snapshot and specify the KMS key to encrypt the snapshot. You can restore the encrypted snapshot as DB instance.

Sharing the snapshot You can share the manual DB snapshot which is both encrypted and unencrypted using authorized AWS account. You can share the unencrypted snapshot as public. If you want to share the encrypted snapshot you can also share the KMS key to the corresponding account.

Exporting the data You can export the snapshots (manual DB snapshot and automated snapshot) in S3. After you exported the data, you can analyze the data using Amazon Athena and Amazon Redshift Spectrum.

Restore the DB instance from the automated backup to a specified point in time.

Restore the DB cluster from the snapshot to a single AZ or Multi-AZ DB instance.

Deleting the snapshot means deleting the snapshot.

Delete DB snapshot

Check Disk Usage in Amazon RDS

RDS supports auto-scaling so it can increase or decrease the storage space in new DB instances or existing DB instances without downtime. Click your database name then the summary window will open. Below the summary window click the configuration tab to view the total space. If you want to view free space click the monitoring tab. The sample screenshots are listed below…

5.Blue/Green Deployment

By using Amazon RDS Blue/Green Deployments, you can create a blue/green deployment for managed database changes. The blue environment is the current production environment. The green environment is the staging environment. The staging environment copies the current production environment for testing purposes without affecting the production environment. When you are ready, you can promote the staging environment to be the new production database environment, with downtime typically under one minute. Currently, blue/green deployments are supported only for RDS for MariaDB and RDS for MySQL.

For example, you can upgrade the major or minor DB engine version, change database parameters, or make schema changes in the staging environment.

Thanks for Reading! Hope you enjoy

--

--