AWS Fundamentals: RDS & AURORA & ElastiCache Flashcards
What does RDS stand for
Relatable Database Service
What is SQL?
Structured Query Language
What is RDS?
Managed DB service that uses SQL
What does RDS allow you to do?
Create databases in the cloud, managed by AWS
What kind of Databases are created using RDS?
Postgres
MySQL
MariaDB
Oracle
Microsoft SQL Server
Aurora (AWS Proprietary Database)
Advantage of using RDS instead of deploying DB on EC2?
It is a Managed Service
What does being managed service mean with RDS?
- Automated provisioning, OS patching
- Continuous backups and 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)
What can you NOT do with RDS?
SSH into instances
How does RDS Storage Auto Scaling work?
Helps increase storage dynamically
When RDS detects you are running out of free DB storage, it scales automatically
What do you need to set up in RDS for Auto Scale to work?
Maximum Storage Threshold
What parameters does RDS need to meet for Storage Auto Scaling to work automatically?
- Free storage is less than 10% of allocated storage
- Low storage lasts at least 5 minutes
- 6 hours passed since last modification
When is Automatically modify storage helpful in RDS?
When you have apps with unpredictable workload
Which DB is Storage Autoscale modification available for?
MariaDB
MySQL
PostgreSQL
SQL Server
Oracle
What are RDS Read Replicas?
They are replicated instances (of main RDS instance) and are ASYNChcronised
How many Read Replicas can you have?
Up to 15
Where can you have Cross Replicas of RDS?
Within AZ, Cross AZ, Cross Region
What does it mean to by ASYNC?
It means that eventually the reads will be consistent once all replicas are caught up/updated
What can you do with the replicas if you don’t want them anymore?
You can promote them to be their own DB
What does the app need to do in order to leverage read replicas?
Update the connection string
Read Replica Use case
When you have a prod app using an RDS instance, and you want to have a reporting app ontop of that RDS instance. You create an RDS instance replica, because that will not slow down the RDS instance.
This case your RDS DB instance creates an ASYNC replication with the RDS replica and the reporting app is reading from there. Leaving the RDS unaffected.
What are Read Replicas only for?
Reads
When does a network cost incur in AWS?
When data goes from one AZ to another
Do you pay network cost for RDS when moving data from one AZ to another?
No, RDS is except as long as the AZ are in the same region.
What is RDS Multi-AZ used for?
Disaster Recovery
How does RDS Multi-AZ work?
You have the master DB which the app reads/writes. Then you also have another RDS DB instance Standby in a different AZ with a SYNC replication and one DNS name for automatic app failover
What does automatic app failover in RDS need to work?
SYNC replication and ONE (same) DNS name
Can Read Replicas be setup as Multi AZ for Disaster Recovery (RD)?
Yes
Multi AZ vs Read Replicas
Read replicas are to be used for different apps that need the same data
Multi AZ is for disaster recovery by using a standby DB. If anything happens to master DB it switches over to the other one and it becomes a master. Its not accessible before the diaster
How to go from Single AZ to Multi AZ
It has zero downtime (no stopping DB)
Click modify for database, it goes from RDS DB instance to a SYNC replication to the Standby DB
What happens when you go from Single AZ to Multi AZ setup? (technical)
RDS DB instance gets snapshotted, the DB snapshot is restored into the other AZ as a standby DB, and Sync Replication between the 2 happens.
What is RDS Custom?
It is a managed Oracle & Microsoft SQL Server Database with OS and DB customisation capabilities
What does RDS do?
Automates setup, operation, scaling of DB in AWS
What access does RDS Custom give you?
To underlying DB and OS
What can you configure with RDS Custom?
Config settings
Install patches
Enable native features
Access underlying EC2 instance with SSH & SSM
What do you need to de-activate before using RDS Custom?
Automation Mode - take snapshot before
RDS vs RDS Custom?
RDS - Entire db and OS managed by AWS
RDS Custom - full admin access to underlying OS & DB
What is Amazon Aurora?
Proprietary technology from AWS (Not open sourced)
What DB are supported with Amazon Aurora DB?
Postgres & MySQL
How does Aurora storage work?
Grows in increments of 10GB up to 128TB
How many Replicas can Aurora have?
15 and replication is faster
How many replicas can MySQL have
5
What is instantaneous with Aurora?
Failover. HA native
Which is more expensive? RDS or Aurora?
Aurora - 20% more
How many copies of Aurora can you have and across how many AZ?
6 copies across 3 AZ
How many copies of Aurora do you need to operate for writes?
4 out of 6
How many copies of Aurora do you need for read?
3 out of 6
What is Aurora’s self healing with peer to peer replication?
If some data are corrupted it does peer to peer replication healing
How many master instances does Aurora have?
one Master instance
How does Aurora fail over work
It is automatic in less than 30 seconds
How many Read replicas can you have along with the Master instance?
1 master and up to 15 replicas
How does Aurora DB Cluster work?
You have the client, client is connected to Writer Endpoint which points to the master instance. The master instance writes to the shared volume (shared with read instances) and each read instance is connected to the Reader Endpoint which is doing the Connection Load Balancing. And that points to the client.
All read instances are in auto scaling mode
Aurora Features
Automatic Fail-over
Backup and Recovery
Isolation and Security
Industry compliance
Push-button scaling
Automated Patching w/ Zero Downtime
Advanced Monitoring
Routine Maintenance
Backtrack: restore data at any point of time without using backups
How does Replica Autoscaling work?
You have a client that points to writer endpoint which is connected to Aurora Master DB. Master writes on shared storage volume which is shared with Replicas.
If for example you have 2 replicas, and they are overloaded, auto scaling kicks in, and more replicas are created. This also extends the Reader Endpoint so the client can point to those Replicas too. All the replicas are now also reading from the shared storage.
How does Custom Endpoint work in Aurora DB?
If for example you have 2 db.r3 large and 2 db.r5.2xlarge replicas, you can create a custom endpoint and connect the larger replicas to that. Why? because they might be better for analytical queries rather than normal queries. Once you create a custom endpoint, the standard reader endpoint is not used, so you should create custom endpoints for all replicas.
What happens when you create a custom endpoint?
Reader endpoint is stopped being used
When would you create custom endpoints?
When you have larger more powerful replicas that can be used for something else, not just standard queries. It could be Analytical Queries for example.
What does Aurora Serverless provide??
Automated DB instantiation & auto scaling based on actual usage
What is Aurora Serverless good for?
Infrequent, intermittent or unpredictable workloads
Do you need to do any capacity planning for Aurora Serverless?
No
How do you pay with Aurora Serverless?
Per second (more cost effective)
Aurora Serverless Architecture
Client speaks to Proxy Fleet (managed by Aurora), which talks to many back end Aurora Instances that are created (shared volume) based on workload.
What does Aurora Multi-Master do?
Immediate failover for write nodes (HA)
What happens during Multi Master Aurora?
All nodes do Read/Write instead of just read
Aurora Multi-Master architecture
3 Aurora DB, all using shared volume.
All 3 are replicating from each other, and the Client is connected to all 3 of them just incase one fails.
What does Global Aurora do?
Cross Region Read Replicas
Global Database
What is Cross Region Read Replicas benefit for Global Aurora?
Useful of disaster recovery
Simple to put in place
Aurora Global Database benefits
- 1 primary region (read/write)
- Up to 5 secondary (read only) regions, replication lag is less than 1 sec
- Up to 16 read replicas per secondary region
- helps for decreasing latency
- promoting another region (for disaster recoverY) has an RTO of < 1 min
- Typical cross-region replication takes less than 1 second
Global Aurora architecture/scenario
Region 1 has Amazon Aurora connected to apps and has read/write.
Region 2 has Amazon Aurora, connected to apps, and read only.
Both are connected by replication.
When something happens to the master DB, the other one gets promoted and begins read/write
What is Aurora Machine Learning
Enables ML-based predictions to apps via SQL
Simple, optimised, secure integration between Aurora and AWS ML services
What services does Aurora ML support?
Amazon SageMaker (use with any ML model)
Amazon Comprehend (for sentiment analysis)
Aurora ML use cases?
fraud detection, ads targeting, sentiment analysis, product recommendations
RDS Backups options
Automated Backups
Manual DB Snapshots
Features of Automated RDS Backups
Daily full backup of DB
Transaction logs backed up every 5 min
restore any point in time from oldest to 5 min ago
1-35 days retention, 0 to disable
What is the retention period of RDS Backups? (automated)
1-35
How do you disable automated RDS backups?
Set retention period to 0
Downside of Automated Backups RDS?
They expire
Manual DB Snapshots benefits
Manually triggered by the user
Retention of backup is unlimited
How long is the retention period for Manual DB Snapshots?
as long as you want - unlimited
A stopped RDS DB you get charged for storage. What can you do to not pay?
Snapshot, stop it, and restore later.
How do Aurora Backups work?
Automated
1-35 days (cant disable)
pint n time recovery in that timeframe
Manual DB Snapshots
manually triggered by user
retention of backup for as long as you want
RDS & Aurora Restore Options
Restore backup or snapshot create new db
Restore MySQL RDS db from S3
Restore MySQL Aurora cluster from S3
How does Restoring MySQL RDS DB from S3 work
create backup of on prem data
store on amazon S3
restore backup file onto new RDS instance running MySQL
How does restoring MySQL Aurora cluster from S3 work
create backup of on prem data using Percona XtraBackup
store backup on S3
Restore backup file on new aurora cluster running MySQL
What happens when you restore an RDS/Aurora back up or snapshot?
Creates a new DB
How does Aurora DB Cloning work?
Create a new Aurora DB cluster from an existing one
Benefits of Aurora DB Cloning
Faster than snapshot & restore
Uses Copy-on-write protocol
Fast and cost effective
How does Copy-On-Write protocol work in Aurora DB Cloning?
The new DB cluster uses the same data volume as the original DB (no copy needed)
When updates are made to the new DB cluster data, additional storage is allocated and data is copied to be separated
When is Aurora DB Cloning useful?
When creating staging DB from a prod DB without impacting prod db
What does RDS & Aurora Security provide?
Encryption at rest/in flight
IAM Auth
Security Groups
No SSH available except on RDS custom
Send audit logs to CloudWatch for longer retention
How does Data At Rest encryption work for RDS & Aurora
DB master & replicas encryption using AWS KMS - defined at launch time
If master is not encrypted - read replicas will also not be
to encrypt an unencrypted DB you need to snapshot and restore as encrypted
How does In-Flight encryption work for RDS & Aurora?
TLS-ready by default
use AWS TLS root cert client-side
What is an Amazon RDS Proxy?
Fully Managed DB proxy for RDS
Why do I need RDS Proxy?
To allow apps to pool and share DB connections established with the DB
Instead of having all connections to RDS DB, they will connect to the proxy and the proxy will send them to the instance.
Why would you use an RDS Proxy?
To improve efficiency and reduce stress on DB resources. Also minimise open connections/timeouts
Is RDS Proxy serverless, autoscaling, HA (multi- AZ)?
Yes
What happens incase of fail over and RDS Proxy?
It reduces failover time by 66%. Connections just connect to that automatically
What DB does RDS Proxy support?
RDS (MySQL, PostgresSQL, MariaDB and Aurora (mySQL, PostgreSQL)
Can you enforce IAM Auth for DB and securely store credentials in AWS Secrets manager with RDS Proxy>
Yes
Is RDS Proxy publicly accessible?
No - must be from VPC
How can RDS Proxy benefit AWS Lambda?
It will soak all the connections (1000s) from Lambda and take care of open connections and timeouts. Then it will transfer them to the RDS DB Instance
What does Amazon ElastiCache do?
Helps you get managed Redis or Memcached
What are caches?
In memory DB with really high perf & low latency
What do caches help with?
reduce load of DB for read intensive workloads
What happens to applications that you ElastiCache?
They become stateless
Does AWS take care of OS maintenance / patching, optimisations, setup, configuration, monitoring, failure recovery and backups?
Yes
What does ElastiCache require you to do before using it?
Heavy app code changes
ElastiCache Architecture
Application performs cache hit on Elasti Cache, if the querry is written there then thats perfect. If its not, then a cache miss happens and the app reads directly from Amazon RDS. Then it writes the querry to ElastiCache for when it is requested again.
Redis features
Multi-AZ with Auto-Failover
Read replicas to scale reads and HA
Data Durability using AOF persistence
Backup and restore features
Supports Sets and Sorted Sets
Cache that is replicated, HA and durable
Memcached features
Multi-node for partitioning of data (sharding)
no HA
non persistent
no backup and restore
multi-threaded architecture
What to remember for Redis
HA, backup, read replicas
What to remember for Memcached
Pure cache distributed
can lose data
no backup restore
no HA
ElastiCache Security
Supports IAM Auth for Redis
What are policies on ElastiCache only used for?
AWS API-level security
What is Redis AUTH?
setting password/token for when you create a Redis cluster
extra level of security for your cache (on top of sec groups)
Supports SSL in flight encryption
Memcached supports for security?
SASL-based auth (advanced)
What are the patterns for loading data into ElastiCache?
Lazy Loading
Write Through
Session Store
What is Lazy Loading?
all read data is cached - data can become stale in cache
What is write through?
adds or update data in cache when written to a DB (no stale date)
What is session store?
store temp session data in cache (using Time To Live features)
What is ElastiCache Redis use cases?
Gaming leaderboards - computationally complex
Redis Sorted sets - guarantee both uniqueness and element ordering
Each time new element added, its ranked in real time, then added in correct order
What is Redis Sorted Sets?
Guarantees uniqueness and element ordering
Port 21
FTP
Port 22
SSH
Port 22 (same as ssh)
SFTP
Port 80
HTTP
Port 443
HTTPS
Port 5432
PostgreSQL
Port 3306
MySQL
Port 1521
Oracle RDS
Port 1433
MSSQL Server
Port 3306 (same as MySQL)
MariaDB
Port 5432
Aurora
What do you do when you plan for Disaster recovery with a MySQL database?
Enable Multi-AZ
Which RDS feature does not require you to change SQL connection string when used?
Multi-AZ
You would like to ensure you have a replica of your database available in another AWS Region if a disaster happens to your main AWS Region. Which database do you recommend to implement this easily?
Aurora Global Database
Your company has a production Node.js application that is using RDS MySQL 5.6 as its database. A new application programmed in Java will perform some heavy analytics workload to create a dashboard on a regular hourly basis. What is the most cost-effective solution you can implement to minimize disruption for the main application?
Create read replica in diff AZ and run analytics workload on replica db
You would like to create a disaster recovery strategy for your RDS PostgreSQL database so that in case of a regional outage the database can be quickly made available for both read and write workloads in another AWS Region. The DR database must be highly available. What do you recommend?
Create read replica in diff region and enable multi-az on the read replica
You have migrated the MySQL database from on-premises to RDS. You have a lot of applications and developers interacting with your database. Each developer has an IAM user in the company’s AWS account. What is a suitable approach to give access to developers to the MySQL RDS DB instance instead of creating a DB user for each one?
Enable IAM DB Authentication
Read Replicas use Async Replication and Multi-AZ uses Sync replication?
True