<h1 style='border: none'><center>Parallel and Distributed Systems Lab 4</center></h1>
<h2 style='border: none'><center>Amazon Web Service(AWS)<br>RDS</center></h2>
<h5><center>The Islamic University of Gaza<br>Engineering Faculty<br>Department of Computer Engineering</center></h5>
<h6>Authors: Usama R. Al Zayan<span style="float:right">2022/10/28</span></h6>
---
## Amazon RDS Overview
* RDS stands for Relational Database Service
* It’s a managed DB service for DB use SQL as a query language.
* It allows you to create databases in the cloud that are managed by AWS:
• Postgres
• MySQL
• MariaDB
• Oracle
• Microsoft SQL Server
• Aurora (AWS Proprietary database)
## Advantage over using RDS versus deploying DB on EC2
* RDS is a managed service:
• Automated provisioning, OS patching
• Continuous backups and restore to specific timestamp (Point in Time Restore)!
• Monitoring dashboards
• Read replicas for improved read performance
• Multi AZ setup for DR (Disaster Recovery)
• Maintenance windows for upgrades
• Scaling capability (vertical and horizontal)
• Storage backed by EBS (gp2 or io1)
* BUT you can’t SSH into your instances
## Storage Auto Scaling
* Helps you increase storage on your RDS DB instance dynamically
* When RDS detects you are running out of free database storage, it scales automatically
* Avoid manually scaling your database storage
* You have to set Maximum Storage Threshold (maximum limit for DB storage)
* Automatically modify storage if:
• Free storage is less than 10% of allocated storage
• Low-storage lasts at least 5 minutes
• 6 hours have passed since last modification
* Useful for applications with unpredictable workloads
* Supports all RDS database engines (MariaDB, MySQL, PostgreSQL, SQL Server, Oracle)
## RDS Read Replicas for read scalabilit
<center>

</center>
* Up to 5 Read Replicas
* Within AZ, Cross AZ or Cross Region
* Replication is ASYNC, so reads are eventually consistent
* Replicas can be promoted to their own DB
* Applications must update the connection string to leverage read replicas
### RDS Read Replicas – Network Cost
* In AWS there’s a network cost when data goes from one AZ to another
* For RDS Read Replicas within the same region, you don’t pay that fee

## How to Create RDS
1. Search for `RDS` service in the top search bar.

2. Click `Create database` Button.

3. Select Engine type.

4. Select `Free tier` template.

5. Enter DB instance name, username and password.

6. Select `db.t2.micro` instance.

7. Enter Allocated storage (min 20 GiB) and disable storage autoscaling.

8. You Can Connect DB to an EC2 instance directly, or set Public access as `yes`.


9. Enter intial Database name and disable automated backups.

10. Click `Create database`.

## Scalability & High Availability
* **Scalability** means that an application / system can handle greater loads by adapting.
* There are two kinds of scalability:
• Vertical Scalability
• Horizontal Scalability (= elasticity)
* Scalability is linked but different to High Availability
* **High availability** means running your application / system in at least 2 data centers (Availability Zones)
* The goal of high availability is to survive a data center loss
### High Availability & Scalability For EC2
* **Vertical Scaling**: Increase instance size (= scale up / down)
• From: t2.nano - 0.5G of RAM, 1 vCPU
• To: u-12tb1.metal – 12.3 TB of RAM, 448 vCPUs
* **Horizontal Scaling**: Increase number of instances (= scale out / in)
• Auto Scaling Group
• Load Balancer
* **High Availability**: Run instances for the same application across multi AZ
• Auto Scaling Group multi AZ
• Load Balancer multi AZ
###### tags: `Parallel and Distributed Systems` `Cloud computing` `IUG` `Computer Engineering`
<center>End Of Lab 4</center>