0% found this document useful (0 votes)
93 views20 pages

Aws RDS

setting up RDS in aws
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views20 pages

Aws RDS

setting up RDS in aws
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

AWS RDS

AGENDA
RDS
MySQL and Amazon Aurora Database Creations and Query Executions

RDS (Relational Database)


Amazon Relational Database Service (Amazon RDS) makes it easy to set up, operate, and scale a relational
database in the cloud. It provides cost-efficient and resizable capacity while automating time-consuming
administration tasks such as hardware provisioning, database setup, patching and backups.

Key Concepts:
➢ Master Replica
➢ Cross Region Replica
➢ Snapshot
➢ Cluster
➢ Clone
➢ Restore from S3
➢ Query Editor
➢ Reserved instance

Key Benefits:
➢ Lower administrative burden - Easy to use.
➢ High Performance - General Purpose (SSD) Storage.
➢ Scalability – Scale-up & Scale-down is possible.
➢ High Availability and durability.
➢ Backup and Recovery: Possible Automated backups.
➢ Data Secure: Possible with all Encryption, Cross Region replication, Clone, Snapshot, Master Replica.
➢ Maintenance in terms of monitoring the metrics.
➢ Cost-effectiveness: Pay only for what you use.
➢ This runs in Server (ex: MySQL) as well as in Serverless infrastructure (ex: Amazon Aurora)
➢ Pricing - https://calculator.s3.amazonaws.com/index.html?lng=#

Pre-defined RDS in AWS:


Database Key Highlights
MySQL Possible free tier, Runs in Server, simple to create
PostgreSQL Open-source, cost involved
SQL Server Open-source, runs in any system, widely use DB
ORACLE Powerful, Need License, useful for Enterprise app
Amazon Aurora Amazon Aurora is a MySQL and PostgreSQL-compatible relational database built for
the cloud that combines the performance and availability of traditional enterprise
databases with the simplicity and cost-effectiveness of open source databases.
MariaDB Open-Source, Made by original developers of MySQL
Difference among AWS Pre-defined Databases:
RDS REDSHIFT DYNAMODB
DB engine Amazon aurora, MySQL, Redshift NoSQL
PostgreSQL, Oracle, SQL
Server and MariaDB
Computing Resources Instances with 64 vCPU & Nodes with vCPU & Not Specified, SaaS
244 GB RAM 244 GB RAM
Data Storage Facility 6 TB per instance and 16 TB per instance Unlimited storage size,
(Max) 20000 IOPS 40,000 read/write per
table
Maintenance 30 minutes per week 30 minutes per week No effect
Multi-AZ Replication As an additional service Manual Built-in
Tables(per basic Defined by DB Engine 9,900 256
structural unit
Main usage feature Conventional DB Data Warehouse DB for dynamically
modified data

AMAZON MySQL DB Creation:


Pre-requisites:
➢ Create an Subnet Group
➢ MySQL DB Creation using AWS console GUI
➢ Create an Amazon Linux EC2 instance
➢ Install MySQL client to enable to connect the MySQL db from instance
➢ Basic SQL Queries

Objective:
➢ Master Replica – Test Synchronization, Auto Instance Promotion of Replica in case of Master DB is down
➢ Snapshot or Image – Versioning

1. Select the Service “RDS” as part of Database in console then Click

Navigate to Below GUI


2. Create a Subnet Group
Subnets should be in different AZ’s, purpose to keep applications and Databases in the different Zones,
This assures Security and high availability.

Click on Create DB Subnet Group

Enter the Parameters:


➢ Name of the subnet / Description: User defined
➢ VPC: Default VPC
➢ Availaility Zones: Choose all Zones listed (ap-south-1a, ap-south-1b and ap-south-1c)
➢ Subnet Groups: Select all three subnet groups
➢ Then Click “Create” – Subnet Group has been created.
➢ Ensure Each Subnet grouped in different AZ
Subnet Group Created

3. Create a MySQL RDS Database


MySQL is the most popular open source database in the world. MySQL on RDS offers the rich features of the
MySQL community edition with the flexibility to easily scale compute resources or storage capacity for your
database.
• Supports database size up to 64 TiB.
• Supports General Purpose, Memory Optimized, and Burstable Performance instance classes.
• Supports automated backup and point-in-time recovery.
• Supports up to 5 Read Replicas per instance, within a single Region or cross-region.
DB Instance created successfully

Check the attributes


4. Create an Amazon Linux EC2 Instance
Customization – Easy to identify instance in future

Create new security Group with MySQL protocol - Public

Create a pem file


Launch Instance

Instance “RDS” Created

Use puttygen and convert pem file into ppk file


I have converted RDSKey.pem into RDSKey.ppk
Use putty to login EC2 instance with EC2 public ip
Take the credentials from connect tab and login.
Once the Login completed, we will get below screen, switch to root user
Install mysql client to enable to listen mysql commands in our EC2

Connect MySQL and Query Execution


Install mysql client to enable to listen mysql commands in our EC2

SQL SAMPLE QUERIES: Please refer for the Practice


KEY CONCEPTS:
MASTER REPLICA:
Key Note: The concept of Replica and Snapshot alone possible in MySQL.
REPLICA CREATED SUCCESSFULLY
Note: Once Replica created the role of the master DB changed from instance to Primary

DELETE MASTER DB INSTANCE AND TRY TO USE REPLICA


Note: Role of Replica changed as “instance”

Try to connect MySQL using greensreplica endpoint and check the data

Note: No single data get lost


Through this we can ensure High Availability of the DB Instance
It avoids business and customer impacts
We cannot take a replica copy from the instance which became a Master
Technical team needs to troubleshoot and up and run the Master
SNAPSHOT:
➢ Dormant data, it is like a image
➢ Kind of Versioning
➢ before perform any Change management, recommend to take a snapshot
➢ In case of failure in CM implementation, we can restore the snapshot
➢ can automate backup
➢ charges applicable
➢ Snapshot create in the same DB zone itself
➢ Snapshot stores at AWS
➢ Can export to S3
➢ Restore the SNAPSHOT when requires to avoid Business impact

Please delete the snapshot immediately.


CLUSTERING:
➢ Group of DBs
➢ Clustering helps to handle huge application request
➢ This distributes request to slaves to perform Read and Write Operations paralley
➢ High level of Performance
➢ Usually Read operations volume is very high
➢ it runs without server or ec2 instance

Create an Amazon Aurora DB Instance: select MySQL edition

Provisioned - Provision and manage server instances – low cost compare to serverless
Serverless - AWS will handle end to end ASG etc - high in cost
Follow below steps and create an aurora DB:
➢ Network & Security (Default VPC, db subnet group, public accessibility (No), AZ, Existing SG)
➢ Database options (Identifier, db name, port(3306), Disable IAM authentication)
➢ Encryption - Disable
➢ Failover - No preferences
➢ Backup - default 1 days
➢ Backtrack - Disable
➢ Log exports - Keep as such
➢ Monitoring - disable
➢ Maintenance - Disable
➢ Deletion protection - uncheck
➢ then click on create database

Reader and Writer has been created

Add New Reader


Follow the instruction mentioned below and create New Reader:
➢ DB instance identifier : reader-1
➢ DB instance class - Burstable classes (includes t classes)
➢ Connectivity - Not publicly accessible
➢ Database authentication - Password authentication
➢ DB cluster parameter - default
➢ Failover priority - No preferences
➢ Encryption - disable
➢ Monitoring - disable
➢ Maintenance - Then click add reader

Add Replica Autoscalling: This Cost very high


It avoids unwanted monitoring
Automatically scale-up and scale-down take place based on connection
Create cross-region read replica
➢ Keep the replica copy in different Regions
➢ If any issue in our region we can make use the replica available in other regions

Create Clone
➢ Copy of a db, It run as a instance
➢ The data persist upto when we taken a Clone, It is not synched with DB
use case:
➢ Helps when the db have a problem, we can take a clone and perform troubleshoot
➢ help to create a new db with same data clone is very much helpful
➢ Read and Write will happen in clone as well

Query Editor: New Feature, Front end tool to connect DB to enable to execute queries
CREATE DATABASE BY RESTORING FROM S3:
Restore the log files or snapshot, data whatever it may be can restore in case of loss in db
with this option

Purchase reserved DB instances – Low cost, because we pay upfront cost

PRICING: understand more refer link: https://calculator.s3.amazonaws.com/index.html?lng=#

DEMOLISH:
1. MySQL: Delete the Master and Replica
2. Amazon Aurora: Delete all the Readers then automatically cluster deleted.
3. Delete subnet group
4. Delete EC2 instance
5. Check any Snapshot created, if yes, delete the same

You might also like