Amazon RDS

General Amazon RDS Concepts

Amazon Relational Database Service (Amazon RDS) is a managed service that makes it easy to set up, operate, and scale a relational database in the cloud.

RDS is an Online Transaction Processing (OLTP) type of database.

The primary use case is a transactional database (rather than analytical).

Best for structured, relational data store requirements.

Aims to be a drop-in replacement for existing on-premise instances of the same databases.

Automated backups and patching applied in customer-defined maintenance windows.

Push-button scaling, replication, and redundancy.

A DB instance is a database environment in the cloud with the compute and storage resources you specify.

Database instances are accessed via endpoints.

Endpoints can be retrieved via the DB instance description in the AWS Management Console, DescribeDBInstances API or describedbinstances command.

Amazon RDS supports the following database engines:

  • Amazon Aurora.
  • MySQL.
  • MariaDB.
  • Oracle.
  • SQL Server.
  • PostgreSQL.

RDS is a managed service and you do not have access to the underlying EC2 instance (no root access).

Encryption

You can encrypt your Amazon RDS instances and snapshots at rest by enabling the encryption option for your Amazon RDS DB instances.

Encryption at rest is supported for all DB types and uses AWS KMS.

When using encryption at rest the following elements are also encrypted:

  • All DB snapshots.
  • Backups.
  • DB instance storage.
  • Read Replicas.

You cannot encrypt an existing DB, you need to create a snapshot, copy it, encrypt the copy, then build an encrypted DB from the snapshot.

You don’t need to modify your database client applications to use encryption.

Encryption/decryption is handled transparently.

RDS supports SSL encryption between applications and RDS DB instances.

RDS generates a certificate for the instance.

Manging encryption keys using Key Management Service (KMS):

  • To manage the keys used for encrypting and decrypting your RDS resources, you use KMS.
  • Using KMS, you can create encryption keys and define the policies that control how these keys can be used.
  • A two-tiered hierarchy is used with envelope encryption:
    • A unique data key encrypts customer data.
    • KMS master keys encrypt the data keys.

Read replica encryption:

  • A Read Replica of an Amazon RDS encrypted instance is also encrypted using the same key as the master instance when both are in the same region.
  • If the master and Read Replica are in different regions, you encrypt using the encryption key for that region.
  • You can’t have an encrypted Read Replica of an unencrypted DB instance or an unencrypted Read Replica of an encrypted DB instance.

Multi-AZ and Read Replicas

Used for high availability, fault tolerance and performance scaling.

The table below compares multi-AZ deployments to Read Replicas:

Comparison of RDS Multi-AZ and Read Replicas

Multi-AZ

Multi-AZ RDS creates a replica in another AZ and synchronously replicates to it (DR only).

There is an option to choose multi-AZ during the launch wizard.

AWS recommends the use of provisioned IOPS storage for multi-AZ RDS DB instances.

Each AZ runs on its own physically distinct, independent infrastructure, and is engineered to be highly reliable.

You cannot choose which AZ in the region will be chosen to create the standby DB instance.

You can view which AZ the standby DB instance is created in.

During failover RDS automatically updates configuration (including DNS endpoint) to use the second node.

Depending on the instance class it can take 1 to a few minutes to failover to a standby DB instance.

It is recommended to implement DB connection retries in your application.

Recommended to use the endpoint rather than the IP address to point applications to the RDS DB.

The method to initiate a manual RDS DB instance failover is to reboot selecting the option to failover.

A DB instance reboot is required for changes to take effect when you change the DB parameter group or when you change a static DB parameter.

The secondary DB in a multi-AZ configuration cannot be used as an independent read node (read or write).

There is no charge for data transfer between primary and secondary RDS instances.

Multi-AZ deployments for the MySQL, MariaDB, Oracle and PostgreSQL engines use Amazon’s failover technology.

Multi-AZ deployments for the SQL Server engine use SQL Server Database Mirroring (DBM).

System upgrades like OS patching, DB Instance scaling and system upgrades, are applied first on the standby, before failing over and modifying the other DB Instance.

In multi-AZ configurations snapshots and automated backups are performed on the standby to avoid I/O suspension on the primary instance.

Read Replica Support for Multi-AZ

  • Amazon RDS Read Replicas for MySQL and MariaDB support Multi-AZ deployments.
  • Combining Read Replicas with Multi-AZ enables you to build a resilient disaster recovery strategy and simplify your database engine upgrade process.
  • A Read Replica in a different region than the source database can be used as a standby database and promoted to become the new production database in case of a regional disruption.
  • This allows you to scale reads whilst also having multi-AZ for DR.
  • Note that RDS for PostgreSQL does not yet support this feature.

The process for implementing maintenance activities is as follows:

  • Perform operations on standby.
  • Promote standby to primary.
  • Perform operations on new standby (demoted primary).

Amazon RDS Multi-AZ

Read Replicas

Read replicas are used for read heavy DBs and replication is asynchronous.

Read replicas are for workload sharing and offloading.

Read replicas provide read-only DR.

Read replicas are created from a snapshot of the master instance.

Must have automated backups enabled on the primary (retention period > 0).

Only supported for transactional database storage engines (InnoDB not MyISAM).

Read replicas are available for MySQL, PostgreSQL, MariaDB, Oracle and Aurora (not SQL Server).

For the MySQL, MariaDB, PostgreSQL, and Oracle database engines, Amazon RDS creates a second DB instance using a snapshot of the source DB instance.

It then uses the engines’ native asynchronous replication to update the read replica whenever there is a change to the source DB instance.

Amazon Aurora employs an SSD-backed virtualized storage layer purpose-built for database workloads.

You can take snapshots of PostgreSQL read replicas but cannot enable automated backups.

You can enable automatic backups on MySQL and MariaDB read replicas.

You can enable writes to the MySQL and MariaDB Read Replicas.

You can have 5 read replicas of a production DB.

You cannot have more than four instances involved in a replication chain.

You can have read replicas of read replicas for MySQL and MariaDB but not for PostgreSQL.

Read replicas can be configured from the AWS Console or the API.

You can specify the AZ the read replica is deployed in.

The read replicas storage type and instance class can be different from the source but the compute should be at least the performance of the source.

You cannot change the DB engine.

In a multi-AZ failover the read replicas are switched to the new primary.

Read replicas must be explicitly deleted.

If a source DB instance is deleted without deleting the replicas each replica becomes a standalone single-AZ DB instance.

You can promote a read replica to primary.

Promotion of read replicas takes several minutes.

Promoted read replicas retain:

  • Backup retention window.
  • Backup window.
  • DB parameter group.

Existing read replicas continue to function as normal.

Each read replica has its own DNS endpoint.

Read replicas can have multi-AZ enabled and you can create read replicas of multi-AZ source DBs.

Read replicas can be in another region (uses asynchronous replication).

This configuration can be used for centralizing data from across different regions for analytics.

Amazon RDS Read Replicas

Scaling Amazon RDS

You can only scale RDS up (compute and storage).

You cannot decrease the allocated storage for an RDS instance.

You can scale storage and change the storage type for all DB engines except MS SQL.

For MS SQL the workaround is to create a new instance from a snapshot with the new configuration.

Scaling storage can happen while the RDS instance is running without outage however there may be performance degradation.

Scaling compute will cause downtime.

You can choose to have changes take effect immediately, however the default is within the maintenance window.

Scaling requests are applied during the the specified maintenance window unless “apply immediately” is used.

All RDS DB types support a maximum DB size of 64 TiB except for Microsoft SQL Server (16 TiB).

Billing and Provisioning:

AWS Charge for:

  • DB instance hours (partial hours are charged as full hours).
  • Storage GB/month.
  • I/O requests/month – for magnetic storage.
  • Provisioned IOPS/month – for RDS provisioned IOPS SSD.
  • Egress data transfer.
  • Backup storage (DB backups and manual snapshots).
  • Backup storage for the automated RDS backup is free of charge up to the provisioned EBS volume size.

However, AWS replicate data across multiple AZs and so you are charged for the extra storage space on S3.

For multi-AZ you are charged for:

  • Multi-AZ DB hours.
  • Provisioned storage.
  • Double write I/Os.
  • For multi-AZ you are not charged for DB data transfer during replication from primary to standby.

Oracle and Microsoft SQL licences are included or you can bring your own (BYO).

On-demand and reserved instance pricing available.

Reserved instances are defined based on the following attributes which must not be changed:

  • DB engine.
  • DB instance class.
  • Deployment type (standalone, multi-AZ_.
  • License model.
  • Region.

Reserved instances:

  • Can be moved between AZs in the same region.
  • Are available for multi-AZ deployments.
  • Can be applied to Read Replicas if DB instance class and region are the same.
  • Scaling is achieved through changing the instance class for compute, and modifying storage capacity for additional storage allocation.
Scroll to Top