Monday, January 6, 2020

AWS Relational Database Service -RDS


Before jumping into AWS Relational Database Service (RDS), first we need to understand, what is the Relational Database and type of relational Database along with its uses.
In Relational database, we store data in Tabular format and there can be a relationship between tables. 
SQL (Structure query language) is used to read, Insert and update the Data in relational Database.
Relational Database uses to store data for OLTP (Online transaction processing) Application. Like Banking etc.

AWS Relational Database Service (RDS)


AWS RDS is fully managed relational database engine service. The AWS RDS service supports six database engines.

1. Below are the activities, AWS will take care for you if you choose the AWS RDS service.

a.       Security of Database Engine

b.      Patching of Database Engine

c.       Automatic Backup of Database Engine

d.      Scaling whenever is required

    2. Every database Instance has a weekly maintenance window which is used for patching etc. You can select Maintenance window while creating the RDS Instance. if you don’t select the maintenance window, AWS assigns any 30 minutes’ maintenance windows randomly with your RDS Instance.
    
    3.  You have to manage below RDS activities, 

a.       Creation of Database Schema

b.      Performance Tuning of Database

c.       Database Setting 

       4.  AWS RDS provides two types of Licensing Model.

a.       BYOL (Bring your own License)

b.      License Included

       5.  AWS RDS Oracle offering comes with BYOL (Bring your own License) model only.

    6.  You can create up to 40 Database engine per account.  Out of 40, up to 10 can be Oracle or SQL Server DB instances under the "License Included" model. All 40 can be used for Amazon Aurora, MySQL, MariaDB, PostgreSQL and Oracle under the "BYOL" model.


    7.   RDS use Elastic Block storage (EBS) only, you cannot use Instance-store volume.

     8.  Maximum storage capacity of RDS database is 16 TB for SQL-Server database Engine and 64 TB for other database engine.

     9. While Creating the RDS using Multi-AZ option, it provides below functionality.

a.       It Create Standby Instance in different AZ in the same region.

b.      It provides Synchronous replication between Primary and Standby Instance.

c.       You cannot perform read/write operation Standby Instance.

   10.    As per the AWS recommendation, you should use provisioned IOPS EBS, if you are choosing RDS Multi-AZ.

    11.   In Multi –AZ RDS option, below are the reasons to trigger the automatic failover from Primary to Standby. Means Standby becomes primary and primary become standby

a.       Primary Database Engine Failure

b.      Loss of AZ

c.       Loss network connectivity from primary database Instance

d.      Compute Failure on Primary Instance

e.       EBS failure on primary Instance

f.        Database Engine Patching

g.       Primary database Engine is changed

    12.   RDS also provides an option for manual failover i.e. Reboot with failover on Primary.

    13.   You should use CNAME (End point) of RDS database Engine in your application instead of IP address, as it CNAME does not change in case of failover.

    14.   Database Subnet Group


a.       If you want to create RDS Instance in specific subnet of your VPC, then you can control this with help of the Database Subnet group. Means it is collection of Subnet in a VPC, which you want use to create the Database Instance in your VPC.
b.      Database Subnet Group contains at least two subnets and Subnet must cover at least two Availability Zones, However AWS recommended Subnet should cover all Availability Zones of region.




    15.   RDS Backup


There is no way to take backup of individual database in RDS Instance, you have to take backup of the entire RDS Instance. There are two ways to backup your RDS Instance.

1.       Automated Backup

2.       Manual Backup

a.       RDS Automatic backup


1.       Backup data are stored in multiple Availability Zones for providing high durability.

2.       Backups are stored on S3.

3.       AWS use Standby Instance only to take the backup.

4.       Database Instance should be in ACTIVE state for automatic backup.

5.       You can select the backup Windows while creating the Database RDS Instance.

6.       Automatic backup is enabled by default. you can disable it. To disable this, you have to change the retention period setting to ZERO.

7.       An outage occurs when you change the retention period setting for ZERO to NON-ZERO.

8.       “Automatic Backup” is deleted automatically when you delete the RDS Instance.

9.       MySQL have two storage engine, which is InnoDB and myISAM. Automatic backup is currently supported for InnoDB storage engine of MySQL.

10.   You cannot share the Automatic backup with other accounts.


b.      RDS Manual Backup


1.       Backups are stored on S3.

2.       “Manual Backup” is not deleted automatically when you delete the RDS Instance.

3.       You can share the manual backup with other accounts.


    16.   Restore the database Snapshot

     17.   RDS alert database Event when failover occurred, you can send the Notification via AWS SNS service.

    18.   You can see the last 14-Days RDS Event via API/CLI and can see 1-day event via AWS Console.

     19.   You can update the database engine version of the existing RDS Instance. You can do it immediately or provide the maintenance window.

     20.   RDS Read-Replica


a.       If you want to offload the read workload from other instance due to heavy I/O, then read-replica is your answer. Read-replica is replica of primary database instance but can be used for read operation only.

b.      Data first written into primary database engine and then asynchronously copied into read-replica instance. There can be time lag between primary and read-replica instance.

c.       MS SQL-server database Engine does not support the read-replica.

d.      To Enable the read-replica, Automatic backup should be enable on RDS instance.

e.       You can create more than one read-replica. MySQL, MariaDB, PostgreSQL, and Oracle allow you to create up to 5 read replicas for a given source DB instance.

f.        You can create read-replica in the same region or in different regions. Different region read-replica is called CROSS REGION READ-REPLICA.

g.       Read-replica Instance type (compute) and storage size can be different from Source but it should be higher or equal from source instance.

h.      You cannot change the Database engine of read-replica Instance, it should be same as the Source.

i.        If you scale the Source Instance, you have to scale the read-replica instance as well.

j.        You can create Read-replica of Read-replica but Oracle and PostgreSQL does not support this.

k.       If you delete RDS Instance and you have created the read-replica on it, Then Read-replica will not delete automatically.

l.        If replication is stopped for more than 30 consecutive days, then AWS terminates the replication and you cannot enable it again. In this case you have to create new read-replica if required again.

21.   RDS Encryption

a.       AWS RDS support SSL encryption, if you want secure communication between your application and database engine.

b.      You can encrypt RDS data at REST by using the AWS KMS key.

c.       Backup of encrypted RDS is also encrypted.

d.      Snapshot of encrypted RDS is also encrypted.

e.       Read-replica of encrypted RDS is also encrypted.

f.        You cannot encrypt existing un-encrypted RDS instance. If you want do that you can create new RDS Instance with snapshot.

    22.   You can use the IAM account to provide access on RDS Instance API.

    23.   RDS Reserved Instance


a.       Like EC2 reserved Instance, you can purchase RDS reserved Instance.

b.      RDS reserved Instance is region specific.

c.       Reserved Instance term option is one year or three years.

d.      to purchase RDS reserved Instance need selection of the following. If exactly match the below properties, then purchased RDS reserved Instance charge will apply on on-Demand RDS Instance

1.       Database Engine

2.       Database Instance type (like d4.m4.10xlarge etc.)

3.       Multi-AZ deployment option(YES/NO)

4.       Term (time period 1 or 3 years)

5.       Offering Type (No Upfront, Partial Upfront, All Upfront)

e.       You can purchase up to 40 reserved DB instances.

f.        RDS DB instance reservation can be applied to a read replica.

g.       you cannot cancel your reserved DB instance, once purchased.

    24.   You can scale RDS storage, but You can only Scale-up. Means you cannot decrease the storage size and Compute.

    25.   You can change the storage type for all supported database engines except MS SQL-Server.
   
    26.   Scaling storage don’t require downtime.

    27.   You cannot change the storage capacity and type of storage of the MS SQL-SERVER window based RDS instance. If you want to do the same, you need to take snapshot and create the new Instance from existing snapshot.

    28.   You can use CloudTrail to logs the all API calls of your RDS instance.


3 comments:

AWS Elastic Compute Cloud -EC2

Elastic Compute Cloud (EC2) is a virtual Machine on AWS Host (Physical servers). AWS uses a XEN hypervisor to create virtualization and p...

Amazon Web Services Fundamentals