Amazon RDS - A closer look when create database
Tags: aws, rds, cloud
Published: 2024-05-21 07:19:01


### Amazon Relational Database Service (RDS)

**Amazon Relational Database Service (RDS)** is a managed database service that lets you run relational database systems in the cloud. RDS takes care of setting up the database system, performing backups, ensuring high availability, and patching the database software and the underlying operating system. RDS also makes it easy to recover from database failures, restore data, and scale your databases to achieve the level of performance and availability that your application requires.

**Amazon RDS** was first released on 22 October 2009, supporting **MySQL** databases. This was followed by support for **Oracle Database** in June 2011, **Microsoft SQL Server** in May 2012, **PostgreSQL **in November 2013, and **MariaDB **(a fork of MySQL) in October 2015, and an additional 80 features during 2017.

In November 2014, AWS announced **Amazon Aurora**, a MySQL-compatible database offering enhanced high availability and performance, and in October 2017 a **PostgreSQL-compatible** database offering was launched.

In March 2019 AWS announced support of **PostgreSQL **11 in RDS, five months after official release.


To deploy a database using RDS, you start by configuring a database instance, which is an isolated database environment. A database instance exists in a virtual private cloud (VPC) that you specify, but unlike an EC2 instance, AWS fully manages database instances. You can’t establish an SSH session to them, and they don’t show up under your EC2 instances.


### ------
### Database Engines

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2rtg6nla13jj0bgkpbev.png)


A database engine is simply the software that stores, organizes, and retrieves data in a database. Each database instance runs only one database engine. RDS offers the following six database engines to choose from:

- **Amazon Aurora** Aurora is Amazon’s drop-in binary replacement for **MySQL** and **PostgreSQL**. Aurora offers better write performance than both by using a virtualized storage layer that reduces the number of writes to the underlying storage. It provides two editions:
    * MySQL compatible
    * PostgreSQL compatible 
    
Depending on the edition you choose, Aurora is compatible with PostgreSQL or MySQL import and export tools and snapshots. Aurora is designed to let you seamlessly migrate from an existing deployment that uses either of those two open source databases. For MySQL-compatible editions, Aurora supports only the InnoDB storage engine. Also, the Aurora Backtrack feature for MySQL lets you, within a matter of seconds, restore your database to any point in time within the last 72 hours. In addition, the Amazon Aurora Serverless feature can automatically scale your database up and down on- demand. You pay compute costs only for when the database in active, potentially saving you large sums of money in the long run.
    - Automatic allocation of storage space in 10 GB increments up to 64 TBs
    - Fivefold performance increase over the vanilla MySQL version
    - Automatic six-way replication across availability zones to improve availability and fault tolerance

- **MySQL** MySQL is designed for OLTP applications such as blogs and e- commerce. RDS offers the latest MySQL Community Edition versions. MySQL offers two storage engines— MyISAM and InnoDB — but you should use the latter with RDS- managed automatic backups.
- **MariaDB** MariaDB is a drop- in binary replacement for MySQL. It was created due to concerns about MySQL’s future after Oracle acquired the company that developed it. MariaDB supports the XtraDB and InnoDB storage engines, but AWS recommends using the latter for maximum compatibility with RDS.
- **PostgreSQL** PostgreSQL advertises itself as the most Oracle- compatible open source database. This is a good choice when you have in- house applications that were developed for Oracle but want to keep costs down.
- **Oracle** Oracle is one of the most widely deployed relational database management systems. Some applications expressly require an Oracle database. 
- **Microsoft SQL Server** RDS offers multiple Microsoft SQL Server versions, ranging from 2012 SP4 GDR to the present. For the edition, you can choose Express, Web, Standard, or Enterprise. The variety of flavors makes it possible to migrate an existing SQL Server database from an on- premises deployment to RDS without having to perform any database upgrades.
- **IBM Db2** RDS offers multiple IBM Db2 versions, mostly 11.5.9.0 version. For the edition, you can choose Standard, or Advanced. Amazon RDS for Db2 supports most of the features and capabilities of the IBM Db2 database. Some features might have limited support or restricted privileges.





### Licensing Considerations

RDS provides two models for licensing the database engine software you run. The license included model covers the cost of the license in the pricing for an RDS instance. The bring your own license (BYOL) model requires you to obtain a license for the database engine you run.

License Included MariaDB and MySQL use the GNU General Public License (GPL) v2.0, and PostgreSQL uses the PostgreSQL license, all of which allow for free use of the respective software. All versions and editions of Microsoft SQL Server that you run on RDS include a license, as does Oracle Database Standard Edition Two (SE2). Bring Your Own License Only the Oracle database engine supports this licensing model. The following Oracle Database editions allow you to bring your own license:
- Enterprise Edition (EE)
- Standard Edition Two (SE2)






### Database Instance Classes

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cvo8hgw567nwl6y7zr6u.png)

When launching a database instance, you must decide how much processing power, memory, network bandwidth, and disk throughput it needs. RDS offers a variety of database instance classes to meet the diverse performance needs of different databases. If you get it wrong or if your needs change, you can switch your instance to a different class. RDS divides database instance classes into the following three types.

- **Standard** Standard instance classes meet the needs of most databases. The latest- generation instance class is db.m6i, which provides up to:
    * 512 GB of memory
    * 128 vCPU
    * 40 Gbps network bandwidth
    * 50,000 Mbps (6,250 MBps) disk throughput
- **Memory Optimized** Memory-optimized instance classes are for databases that have hefty performance require- ments. Providing more memory to a database allows it to store more data in memory, which can result in faster query times. The most memory- optimized instance class is db.x1e, and it provides up to:
    * 3,904 GB of memory
    * 128 vCPU
    * 25 Gbps network bandwidth
    * 14,000 Mbps (1,750 MBps) disk throughput
Database instances use EBS storage. Both the standard and memory- optimized instance class types are EBS optimized, meaning they provide dedicated bandwidth for transfers to and from EBS storage.
- **Burstable Performance** Burstable performance instances are for development, test, and other nonproduction data- bases. The latest burstable performance instance class available is db.t4g, and it gives you up to:
    * 32 GB of memory
    * 8 vCPU
    * 5 Gbps network bandwidth
    * 2,048 Mbps (256 MBps) disk throughput
The db.t3, db.m5, and db.r5 classes are based on the AWS Nitro System, accounting for significantly improved performance over older generation instance classes. Note that disk reads and writes count against the maximum disk throughput on these instance classes.




### Storage

**Understanding Input/Output Operations per Second**

IOPS (Input/output operations per second) is a performance indicator that measures the speed and efficiency of a storage device based on the number of read/write operations it can complete within a second. It is also a standard performance benchmark for storage systems, such as hard disk drives (HDD), flash drives, and solid-state drives (SSD).

AWS measures storage performance in input/output operations per second (IOPS). An input/ output (I/O) operation is either a read from or write to storage. All things being equal, the more IOPS you can achieve, the faster your database can store and retrieve data. RDS allocates you a number of IOPS depending on the type of storage you select, and you can’t exceed this threshold. The speed of your database storage is limited by the number of IOPS allocated to it. The amount of data you can transfer in a single I/O operation depends on the page size that the database engine uses.

Example: 

MySQL and MariaDB have a page size of 16 KB. Hence, writing 16 KB of data to disk would constitute one I/O operation. Oracle, PostgreSQL, and Microsoft SQL Server, IBM Db2 use a page size of 8 KB. Writing 16 KB of data using one of those database engines would consume two I/O operations. The larger the page size, the more data you can transfer in a single I/O operation.


Assuming a 16 KB page size, suppose your database needed to read 102,400 KB (100 MB) of data every second. To achieve this level of performance, your database would have to be able to read 6,400 16 KB pages every second. Because each page read counts as one I/O operation, your storage and instance class would need to be able to sustain 6,400 IOPS. Notice the inverse relationship between IOPS and page size: the larger your page size, the fewer IOPS you need to achieve the same level of throughput.

Things get interesting when you move beyond a 32 KB page size. If your database engine writes more than 32 KB in a single I/O operation, AWS counts that as more than one I/O operation. For example, reading or writing a 64 KB page would count as two I/O operations. A 128 KB page would count as four I/O operations.

[Amazon RDS DB instance storage](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS.Realized)


The number of IOPS you can achieve depends on the type of storage you select. RDS offers the following three different types of storage.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eiu9ahgsunaz71y2dntz.png)


- **General Purpose SSD** – [General Purpose SSD](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#Concepts.Storage.GeneralSSD) volumes offer cost-effective storage that is ideal for a broad range of workloads running on medium-sized DB instances. General Purpose storage is best suited for development and testing environments.
- **Provisioned IOPS SSD** – [Provisioned IOPS storage](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#USER_PIOPS) is designed to meet the needs of I/O-intensive workloads, particularly database workloads, that require low I/O latency and consistent I/O throughput. Provisioned IOPS storage is best suited for production environments.
- **Magnetic** – Amazon RDS also supports magnetic storage for backward compatibility. We recommend that you use General Purpose SSD or Provisioned IOPS SSD for any new storage needs. The maximum amount of storage allowed for DB instances on magnetic storage is less than that of the other storage types. For more information, see [Magnetic storage](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Storage.html#CHAP_Storage.Magnetic).




# Storage autoscaling

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.Autoscaling

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v1dm6pssu5l7vsts3r59.png)

If your workload is unpredictable, you can enable storage autoscaling for an Amazon RDS DB instance. 


### Using a dedicated log volume (DLV) (Only for Provisioned IOPS volume)

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIOPS.StorageTypes.html#USER_PIOPS.dlv


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vxomzmtq6xrgjc6ojw3e.png)


You can use a dedicated log volume (DLV) for a DB instance that uses Provisioned IOPS (PIOPS) storage. A DLV moves PostgreSQL database transaction logs and MySQL/MariaDB redo logs and binary logs to a storage volume that's separate from the volume containing the database tables. A DLV makes transaction write logging more efficient and consistent. DLVs are ideal for databases with large allocated storage, high I/O per second (IOPS) requirements, or latency-sensitive workloads.

DLVs are supported for PIOPS storage (io1 and io2 Block Express) and are created with a fixed size of 1,000 GiB and 3,000 Provisioned IOPS.

### Availability & durability

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rzzcfprpl86hn8uh1xp6.png)


Multi-AZ deployments in RDS provide improved availability and durability for database instances, making them an ideal choice for production database workloads.
With Multi-AZ DB instances, RDS synchronously replicates data to a standby instance in a different Availability Zone (AZ) for enhanced resilience. You can change your environment from
Single-AZ to Multi-AZ at any time. Each AZ runs on its own distinct, independent infrastructure and is built to be highly dependable.

In the event of an infrastructure failure, RDS initiates an automatic failover to the standby instance, allowing you to resume database operations as soon as the failover is complete. Additionally, the endpoint for your DB instance remains the same after a failover, eliminating manual administrative intervention and enabling your application to resume database operations seamlessly.





### Connectivity 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nc9w9wmltrd7v7dof4zf.png)


- **IPv4** Your resources can communicate with your databases only over the IPv4 addressing protocol. Resources include clients and AWS resources, such as EC2 instances.
- **Dual-stack mode** Your resources can communicate over the IPv4 addressing protocol, the IPv6 addressing protocol, or both. If you have any resources that must communicate with your database over IPv6, use dual-stack mode.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/30sbwd2j23a44ykxf9xt.png)

Specify the TCP/IP port that the DB instance will use for application connections. The connection string of any application connecting to the DB instance must specify the port number of the DB instance. Both the security group applied to the DB instance and your company’s firewalls must allow connections to the port.





![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gwo89q32jj8kom10bnp3.png)


- **Password authentication** Manage your database user credentials through your DB engine's native password authentication features. To learn more, see the documentation for your DB engine.
- **Password and IAM database authentication** Manage your database user credentials through your DB engine's native password authentication features and IAM users and roles. IAM helps an administrator securely control access to AWS resources. IAM administrators control who can be authenticated and authorized for RDS resources.


### Monitoring

[Monitoring DB load with Performance Insights on Amazon RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PerfInsights.html)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/n6mk9axcxi9l3hcud5ur.png)

Performance Insights is an advanced database performance monitoring feature that makes it easy to diagnose and solve performance challenges on Amazon RDS databases.




![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ax0oszd3xqd7o72f2fm7.png)


After you enable this feature for a database instance, you get access to over 50 new CPU, memory, file system, and disk I/O metrics. You can enable these features on a per-instance basis, and you can choose the granularity (all the way down to 1 second). 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/30w9cddw6yted6s50jp0.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xgt4cikrm8jfrq0fwxyk.png)




### Additional configuration

[Overview of parameter groups](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/parameter-groups-overview.html) 

A DB parameter group acts as a container for engine configuration values that are applied to one or more DB instances.

DB cluster parameter groups apply to Multi-AZ DB clusters only. In a Multi-AZ DB cluster, the settings in the DB cluster parameter group apply to all of the DB instances in the cluster. The default DB parameter group for the DB engine and DB engine version is used for each DB instance in the DB cluster.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4qeae05izav0flvk5wai.png)


[Working with option groups](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithOptionGroups.html)

Different database engines offer various features or options to help you manage your databases and improve security. Option groups let you specify these features and apply them to one or more instances. Options require more memory, so make sure your instances have ample memory and enable only the options you need.
The options available for a database option group depend on the engine. Oracle offers Amazon S3 integration. Both Microsoft SQL Server and Oracle offer transparent data encryption (TDE), which causes the engine to encrypt data before writing it to storage.
MySQL and MariaDB offer an audit plug- in that lets you log user logons and queries run against your databases.




![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/on3rbf78kg19nlc95tud.png)

The backup retention period determines the period for which you can perform a point-in-time recovery



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a1j8kl7cg9a3q876s5a4.png)



[Replicating automated backups to another AWS Region](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ReplicateBackups.html) 

You can replicate automated backups to another AWS Region to help with disaster recovery. Snapshots and transaction logs are replicated immediately after they are available in the source.



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/atoym4bpj40f971nkew1.png)

Choose to encrypt the given instance. Master key ids and aliases appear in the list after they have been created using the Key Management Service (KMS) console.

The AWS KMS key is used to protect the encryption key that is used to encrypt this replicated automated backup in the destination AWS Region.



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5ljtkhruc8qcofpsssld.png)

[Specifying the logs to publish to CloudWatch Logs](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_LogAccess.Procedural.UploadtoCloudWatch.html#integrating_cloudwatchlogs.configure)




![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mj38hbvkngkgdn4litxy.png)

Specify Yes to enable automatic upgrades to new minor versions as they are released. The automatic upgrades occur during the maintenance window for the DB instance.



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6w98ndxikpd9uckt31yl.png)

Protects the database from being deleted accidentally. While this option is enabled, you can’t delete the database.



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/q7ahu2dcnxfvfo8mipp4.png)


[AWS Pricing Calculator](https://calculator.aws/#/?key=new)

[Amazon RDS pricing](https://aws.amazon.com/rds/pricing/)