RDS & Elasticache Flashcards

1
Q

rds encryption

A
  • at rest
    • can use AWS KMS - AES 256 encryption
    • defined at launch time
    • if master is not encrypted, read replicas cannot be encrypted
    • transparent data encryption TDE availabe for oracle and sql server
  • in flight encryption
    • ssl cert
    • provide ssl options with trust cert when connecting
    • then manually enforce ssl on DB- rds.force_ssl = 1
  • encryption operations
    • encrypting backups - unencrypted db = unencrypted snapshots
    • can copy a snapshot into an encrypted one
    • to encrypt an un-encrypted RDS DB
      • create snapshot, copy and enable encryption, restore from encrypted DB
      • migrate apps from old db to new encrypted one
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

RDS auth

A

traditional username and password to login or can use IAM based auth for RDS mysql and postgresql

  • RDS IAM auth
    • just need an auth token obtained using IAM and RDS API calls
    • 15 lifetime
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

RDS db engines

A
  • postgres
  • mysql
  • oracle
  • aurora
  • microsoft sql server
  • mariadb
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

why use RDS? it’s managed!

A
  • auto provisioning and OS patching
  • continuous backups and point in time restore
    • automatic daily full backups during maintenance window
    • transaction logs are backed up every 5 minutes
    • restore to any point in time from oldest backup up to 5 mins ago
    • 7 days to 35 days
    • snapshots - backups that are manually triggered by user
  • monitoring
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

RDS read replicas

A
  • read scalability
  • up to 5 read replicas
  • within AZ, cross AZ, or cross Region
  • replication is ASYNC so reads are eventually consistent
  • can promote to its own DB
  • network cost
    • normally in AWS there’s a cost when data goes from one AZ to another. Exceptions are for managed services like RDS
      • same region, different AZ - no fee for RDS
      • cross region replica - costs $
  • use case: reporting and analytics on top of existing DB
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

RDS multi-az

A
  • (disaster recovery)
    • sync replication
    • one DNS name - automatic app failover
    • can setup Read Replicas as multi-az if you wanted to.
    • converting from single-az to multi-az
      • zero downtown
      • click modify for DB, create standby DB with sync replication
  • I/O activity is no longer suspended on your primary during your preferred backup window, since backups are taken from the standby.
  • ## multi-az standby cannot serve requests
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

can you ssh into RDS instances?

A

nah

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

RDS storage auto scaling

A
  • helps increase storage dynamically
  • set max storage threshold
  • automatically modify storage if:
    • free storage is less than 10% of allocated storage
    • low storage lasts at least 5 minutes
    • 6 hrs have passed since last modification
  • useful for unpredictable workloads with support for all db engines
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Amazon Aurora

A
  • not open source
  • compatible with Postgres and MySQL
  • cloud optimized claims 5x performance improvement over mysql on rds and 3x performance of postgres on RDS
  • up to 15 replicas (mysql has 5), faster replication process
  • 20% more $ than RDS
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Aurora availability and read scaling

A
  • 6 copies across 3 AZs automatically
    • 4 copies out of 6 needed for writes
    • 3 copies out of 6 needed for reads
    • self healing peer to peer replication
    • storage is striped across 100s of volumes
      • storage automatically grows in increments of 10GB, up to 128TB
  • one master writer instance
    • any read replica can become master
  • 30 second automatic failover
  • support for cross region replication
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Aurora load balancing

A
  • writer endpoint - points to master
  • reader endpoint - connection load balancing
    • load balancing happens at connection level not statement level
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Elasticache

A
  • managed Redis or Memcache
    • in-mem dbs with really high performance
    • helps reduce load off dbs for read intensive workloads
    • helps make app stateless
  • involves heavy application code changes
  • cache must have invalidation strategy to make sure only the most current data is used
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Redis vs Memcached

A
  • redis
    • multi az with auto failover
    • read replicas to scale reads and high availability
    • data durability, persistence, backup and restore features
    • all nodes must reside in the same region
  • Memcached
    • multi-node for partitioning of data (sharding)
    • no high availability (replication)
    • non persistent, no backup and restore
    • multi threaded
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Lazy Loading / Cach-Aside / Lazy Population

A

(good for READ performance)
- try cache, on miss, request from db and then write to cache
- pros
- only requested data is cached
- node faulres not fatal (just increased latency)
- cons
- cache miss penalty (read penalty) = 3 network calls (noticeable delay)
- stale data - if data is updated in RDS, then it needs to be updated in the cache

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Write through

A

(Write performance)
- write to cache when db is written to
- pros
- data in cache is never stale, reads are quick
- write penalty - each write requires 2 calls
- cons
- missing data until it is updated in the DB. mitigation is to combine lazy loading strategy as well.
- cache churn - a lot of the data will never be read (bad if cache is small)
- TTL is not a great idea with vanilla writethrough

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Elasticache evictions / TTL

A
  • delete an item explicitly from cache
  • memory is full, evict least recently used (LRU)
  • you set a TTL manually
    • leaderboards, comments, etc
    • range from a few seconds to hours or days
  • too many evictions? then scale up or out!
17
Q

Elasticache cluster mode disabled replication

A
  • one primary node, 0 to 5 replicas
    • on failure of primary, replicas take over
  • asynchronous replication
  • primary is read/write
  • other nodes are read-only
  • 1 shard = 1 node group = 1 primary + replica nodes
    • all nodes have all the data
  • multi AZ enabled by default for failover
18
Q

RDS disaster recovery

A

Read Replicas can also be created in a different Region than the source database. Using a cross-Region Read Replica can help ensure that you get back up and running if you experience a regional availability issue

Amazon RDS provides high availability and failover support for DB instances using Multi-AZ deployments. Amazon RDS uses several different technologies to provide failover support. Multi-AZ deployments for MariaDB, MySQL, Oracle, and PostgreSQL DB instances use Amazon’s failover technology.

The automated backup feature of Amazon RDS enables point-in-time recovery for your database instance. Amazon RDS will backup your database and transaction logs and store both for a user-specified retention period. If it’s a Multi-AZ configuration, backups occur on the standby to reduce I/O impact on the primary. Automated backups are limited to a single AWS Region while manual snapshots and Read Replicas are supported across multiple Regions.

19
Q

RDS automated backups are limited to

A

a single region. manual snapshots and read replicas can be cross region

20
Q

Redis cluster mode enabled limitations

A

You cannot manually promote any of the replica nodes to primary.

Multi-AZ is required.

You can only change the structure of a cluster, the node type, and the number of nodes by restoring from a backup.

21
Q

elasticache replication

A

When you add a read replica to a cluster, all of the data from the primary is copied to the new node. From that point on, whenever data is written to the primary, the changes are asynchronously propagated to all the read replicas, for both the Redis offerings (cluster mode enabled or cluster mode disabled).

22
Q

RDS updates

A

Running a DB instance as a Multi-AZ deployment can further reduce the impact of a maintenance event because Amazon RDS applies operating system updates by following these steps:

Perform maintenance on the standby.

Promote the standby to primary.

Perform maintenance on the old primary, which becomes the new standby.

When you modify the database engine for your DB instance in a Multi-AZ deployment, then Amazon RDS upgrades both the primary and secondary DB instances at the same time. In this case, the database engine for the entire Multi-AZ deployment is shut down during the upgrade.