AWS Relational and Non-Relational Databases

Introduction

 Before we start with AWS databases we understand the basics of the database.
A database is an organized collection of information. it makes data management easy. You can organize data into tables, rows, columns, and indexes to find relevant information. The main purpose of the database is to operate a large amount of information by storing, retrieving, and managing data.

Here we will discuss the Relational Database and  Non-Relational Database.

Relational Database/SQL Database

A relational database is one that stores data in tables. The relationship between each data and searching through those relationships is relatively easy. The relationship between tables and field type is called a schema. for a relational database, the schema must be clearly defined.


Or, we can simply say that Relational Databases show the relationship between tables is related to each other. In this database, each field is filled, you can not leave an empty field. It is best suitable for OLTP (Online Transaction Processing).


Amazon RDS(Relational Database Service)

Amazon RDS is the “managed” relational database service offered as a web service by amazon. it makes it easy to set-up and operate a relational database in the cloud. It provides a very cost-effective way to use the industry’s leading RDBMS software as a managed service. because of this web service from amazon AWS, you do not have to buy any server or install any database software in it. you just subscribe to the was RDS web service and start using it. It can do various automated tasks, such as doing security patches, backups, etc.

AWS fully Managed RDS Service Where AWS is Responsible for

  • Security and patching 
  • Automated backup
  • Multi-AZ (For Disaster Recovery)
  • Read Replica (For performance)
  • Software updates for the DB engine
  • By default, Every database has a weekly maintenance window(max. 1-35 days)

Automated Backups 

Automated backups are enabled by default. The backup data is store in an S3 bucket. Backups are taken within a defined window. During the backup window, storage I/O may be suspended while your data is being backed up and you may experience elevated latency.
Database Snapshots: DB snapshots are done manually. They are stored even after you delete the original RDS instance.


Multi-AZ in RDS

Multi-AZ allows you to have an exact copy of your production database in another availability zone. AWS handles the replication for you, so when your production database is written, this will automatically be synchronized to the standby database.

  • You can select the Multi-AZ(availability zone) option during the RDS DB instance launch.
  • RDS service creates a standby instance in a different AZ in the same region and configures “Synchronous Replication” between the primary and standby DB.
  • You can not read/write to the standby RDS DB instance.
  • You can not select which AZ in the region will be chosen to create the standby DB instance. 
  • You can however view which AZ is selected after the standby is created.
  • AWS recommends the use of a provisioned IOPS instance for multi-AZ RDS instance.

Read Replicas

Read replicas allow you to have a read-only copy of your production database. this is achieved by using asynchronous replication from the primary RDS instance to the read replica. you use read replicas primarily for every read-heavy database workload. Read replica is used for scaling not for data recovery. you can have up to 5 read replica copy of any database. You can have a read replica in a second region. 

License Options for RDS

There are basically two license option for RDS

  1. BYOL: Bring your own online license(user your license)
  2. License Included: AWS provides a license. 

RDS Instance Storage in AWS

Amazon RDS uses EBS volumes (not instance store) for DB and log storage. 

  • General Purpose: use for moderate i/o requirement.
  • Provisional IOPS: Use for high-performance OLTP workloads.

RDS Limits in AWS

You can create up to 40DB instances per account.

AWS Templates Available in RDS

  1. Production: These templates use for production with high availability and consistent performance of any application.
  2. Dev/Test: These templates use for development or testing applications outside of production.
  3. Free-Tier: Use the free tier template to develop a new application, test the existing app, or gain hands-on experience.

Relational Database Service (RDS) Flavors

  1. Amazon Aurora
  2. MySQL
  3. PostgreSQL
  4. MariaDB
  5. Oracle
  6. Microsoft SQL Server

Backup and Restore your RDS DB Instance

There are 2 methods to Backup and restore your RDS DB instance

  1. AWS RDS Automated backup
  2. User-Initiated Manual backup. 

More Information for backup and restore RDS DB

    • You can take backup by selecting the automated backup option this backup can be done in multiple AZ and store this backup in the S3 bucket.
    • Automated backups are deleted when you delete your RDS DB instance.
    • The retention period (automated backup time) is 7 days(by default) via an AWS console but you can increase it up to 35 days.
    • AWS Aurora is an exception its default Retention Period is 1 day.
    • For all DB Retention Period via CLI or API one day by default.
    • If you don’t want to backup set ZERO in Retention Period

    Database Encryption

    You can not encrypt an existing unencrypted DB instance.but you can do that you need to:

    • create a new encrypted instance and migrate your data to it (from unencrypted to encrypted)
    • you can restore from a backup/snapshot into a new encrypted RDS instance.
    • RDS support encrypted at rest for all DB engine using KMS

    Some Other AWS Database Information

    Redshift(OLAP)

    Amazon Redshift is a fast and powerful, fully managed data where house service in the cloud. Datastore analysis and this data can be store in compressed formate. In redshift datastore on the node. when you hit a query for data then parallel processing run.
    *Redshift always attempts to maintain at least 3 copies of your data.
    *By default retention period is 1 day but you can change this retention period max. 35 days.

    Redshift Availability 

    Currently available in 1 AZ but you can restore snapshots to new AZ in the event of an outage.

    Aurora 
    Amazon Aurora is a MySql and Postgre SQL-compatible relational database engine that combines the speed and availability of high-end commercial databases with the simplicity and cost-effectiveness of an open-source database. amazon aurora is serverless.
    2 copies of your data are contained in each availability zone, with a minimum of  3 availability zones. means 6 copies of your data.
    Three Types of aurora replicas are available:

    1. Aurora Replicas
    2. MYSQL Read Replicas
    3. PostgreSQL 

    Backups with Aurora

    • Automated backups are always enabled on Amazon Aurora DB instances. Backup do not impact database performance.
    • You can take snapshots also.
    • you can share Aurora snapshots with other AWS account.

    Non-Relational Database/NoSQL

    It is a database that does not follow the relational database model provided by the relational database management system. In non-relational database data table not show the relation with other database table and no need to provide each column value here. It is mainly used for reading data type applications e.g., gaming.
    NoSQL databases are widely recognized for their ease of development, functionality, and performance at scale.

    DynamoDB 

    Amazon DynamoDB is a fast and flexible NoSQL database service for all applications that need consistent, single-digit millisecond latency at any scale. it is a fully managed database and supports both document and key-value data models. it is a flexible data model and reliable performance makes it a great fit for mobile, web, gaming, etc. data stored on SSD storage.

    Features

    • Dynamo DB allows you low latency read/write access to items ranging from 1 byte to 400kb.
    • Dynamo DB can be used to store a pointer to S3 store objects or items of a size larger than 400KB.
    • Dynamo DB tables are Schemaless
    • Dynamo DB can do 10,000 write capacity units/sec or 10,000 read capacity units per second per table if you want high then just request to AWS.

    Dynamo DB limits

    • 256 tables per account per region.

    Types of NoSQL DB

    • Key-value: Key-value databases are highly partitionable and allow horizontal scaling at scales that other types of databases cannot achieve. Use cases such as gaming, ad tech, and IoT lend themselves particularly well to the key-value data model.
    • Document: In application code, data is represented often as an object or JSON-like document because it is an efficient and intuitive data model for developers.
    • Graph: A graph database’s purpose is to make it easy to build and run applications that work with highly connected datasets.
    • In-memory: Gaming and ad-tech applications have use cases such as leaderboards, session stores, and real-time analytics that require microsecond response times and can have large spikes in traffic coming at any time.
    • Search: Many applications output logs to help developers troubleshoot issues.