AWS Fundamentals: RDS + Aurora + ElastiCache Flashcards
What is RDS?
Relational Database Service is a managed DB service for DB use SQL as a query language.
What does RDS do?
It allows creating databases in the cloud that are managed by AWS
Two ways of deploying a database:
RDS & using an EC2
Features:
- 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)
RDS
RDS is a ……., but you can’t ….. into your instances.
managed service, SHH
What helps you increase storage on your DB instance
dynamically?
RDS - storage auto scaling
If using “storage auto scaling” you need to set:
Maximum Storage Threshold (maximum limit for DB storage)
RDS 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
RDS storage auto scaling is useful for:
Applications with unpredictable workloads
What is a read replica?
Helps scale reads.
Up to …. read replicas.
15
Within……, ……… or ………. is ASYNC, so reads are eventually…………..
AZ, Cross AZ, Replication, consistent
Replicas can be promoted to their own DB?
True
How can applications leverage read replicas?
They must update the connection string.
What are statements are read replicas used for?
SELECT
What are statements are read replicas NOT used for?
INSERT, UPDATE, DELETE
In AWS there’s a …… when data goes from one AZ to another
network cost
RDS Read Replicas within the same region, don’t pay network cost fee?
True
What is RDS Multi AZ mainly used for?
Disaster Recovery
How does RDS Multi AZ work?
With sync replication it writes to a RDS instance on standby in a different AZ
RDS communicates over one DNS name?
True
Features:
- increase availability
- Failover in case of loss of AZ, loss of network, instance or storage failure
- No manual intervention in apps
- Not used for scaling
RDS Multi AZ
The Read Replicas can be setup as Multi AZ for Disaster Recovery?
True
How do you change from Single-AZ to Multi-AZ?
Click on “modify” for the database and enable multi-az.
Is there downtown when changing from single to multi AZ?
No downtime.
What are the steps taken to change from single to multi AZ?
- A snapshot is taken
- A new DB is restored from the
snapshot in a new AZ - Synchronization is established
between the two databases
What is Auroa?
Aurora is a proprietary technology from AWS
………….. and ………. are both supported as Aurora DB
Postgres, MySQL
At-rest encryption:
How are Database master & replicas encrypted?
AWS KMS – must be defined as launch time
At-rest encryption:
If the master is not encrypted…..
the read replicas cannot be encrypted
At-rest encryption:
How do you encrypt an un-encrypted database?
go through a DB snapshot & restore as encrypted
What is at-rest encryption?
This when data is encrypted on the volumes.
What is in-flight encryption?
When data is encrypted between client and database.
How do is In-flight encryption enabled?
Clients must use the TLS root certificates from AWS. AWSTLS root certificates
How can you connect to your database?
IAM Authentication: IAM roles to connect to your database (instead of username/pw)
Security Groups: Control Network access to your RDS / Aurora DB
No ….. available except on RDS Custom
SSH
What is Amazon RDS Proxy?
Fully managed database proxy for RDS
What does Amazon RDS Proxy do?
Allows apps to pool and share DB connections established with the database
What does Amazon RDS Proxy accomplish?
Improves database efficiency by reducing the stress on database resources (e.g., CPU, RAM) and minimize open connections (and timeouts)
What is RDS service is: Serverless, autoscaling, highly available (multi-AZ)
Amazon RDS Proxy
What does RDS Proxy enforce?
IAM authentication for your database. Makes sure that people can only connect to your RDS database instance using IAM.
How can you access RDS Proxy?
Never publicly accessible - must be accessed from VPC
What is ElastiCache for?
It is to get managed Redis or Memcached
What are caches?
Caches are in-memory databases with really high performance, low latency
What is the purpose of a cache?
Helps reduce load off of databases for read intensive workloads
What does a cache make your appication?
Helps make your application stateless
Two kinds of “solutions architecture” for caching?
DB Cache & User Session Store
How does DB Cache work?
Applications queries ElastiCache, if not available, get from RDS and store in ElastiCache.
What kind of strategy should be implemented along with a DB cache system?
Cache must have an invalidation strategy to make sure only the most current data is used in there.
How does User Session Store work?
- User logs into any of the application
- The application writes the session data into ElastiCache
- The user hits another instance of our application(Amazon Elastic cache…i think)
- The instance retrieves the data and the user is already logged in
Features:
- Multi-AZ with auto failover
- Read Replicas to scale reads and have high availability
- Data durability using AOF persistence
- Supports Sets and Sorted Sets
REDIS
Features:
- Multi-node for partitioning of data (sharding)
- No high availability (replication)
- Non persistent
- No backup and restore
- Multi-threaded architecture
MEMCAHCED
Caching strategies:
- Lazy Loading/ Cache-Aside/ Lazy Population
- Write Through - Add or Update cache when database is updated
- Cache Evictions and Time-to-live (TTL)
Lazy Loading/ Cache-Aside/ Lazy Population, Pros:
- Only requested data is cached (the cache isn’t filled up with unused data)
- Node failures are not fatal (just increased latency to warm the cache)
Lazy Loading/ Cache-Aside/ Lazy Population, Cons:
- Cache miss penalty that results in 3 round trips, noticeable delay for that request
- Stale data: data can be updated in the database and outdated in the cache
Write Through - Add or Update cache when database is updated, Pros:
- Data in cache is never stale, reads are quick
- Write penalty vs Read penalty (each write requires 2 calls)
Write Through - Add or Update cache when database is updated, Cons:
- Missing Data until it is added / updated in the DB. Mitigation is to implement Lazy Loading strategy as well
- Cache churn – a lot of the data will never be read
Which caching strategy does this describe:
First, if cache has something - Cache hit.
If there is no Cache hit, it’s called a Cache miss.
So we go and read the data from your database, then write that data to the cache to make sure other application that requests the same data will go directly into Cache hit.
Lazy Loading/ Cache-Aside/ Lazy Population
Which caching strategy does this describe:
When our application talks to ElastiCache and we get a Cache hit there is a write happening to RDS, so when our application modifies the Amazon RDS database, it’s going to write to the cache. It writes through the cache to the RDS
Write Through - Add or Update cache when database is updated
Cache eviction can occur in three ways:
- You delete the item explicitly in the cache
- Item is evicted because the memory is full and it’s not recently used (LRU: Lest Recently Used)
- You set an item time-to-live (or TTL)
TTL are helpful to manage what kind of data:
- Leaderboards
- Comments
- Activity streams
……………./………….. is easy to implement and works for many situations as a…………, especially on the…….. side
Lazy Loading / Cache aside, foundation, read
………. is usually combined with …………… as targeted for the queries or workloads that benefit from this optimization( …… ,the go to solution)
Write-through, Lazy Loading, Not
Setting a ……. is usually not a bad idea, except when you’re using ……… Set it to a sensible value for your application
TTL, Write- through
Only….. the data that makes sense (user profiles, blogs, etc…)
cache