[Developer] Advanced Database Topics Flashcards

(49 cards)

1
Q

What problem does connection pooling solve?

A

DB Request Throttling/DDOS type errors

When you have too many things trying to authenticate (which takes time) or make requests (which adds load) to a DB

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

What is AWS’s Managed Connection Pooling Solution?

A

RDS Proxy

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

How does a client authenticate to RDS Proxy?

A

IAM Credentials

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

How does RDS Proxy authenticate to a database?

A

secrets, which must be stored in AWS Secrets Manager

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

In an RDS Proxy setup, what additional work is needed in a failover situation?

A

None. RDS Proxy handles all failover work automatically

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

What is a connection pool?

A

A dedicated set of warm, authenticated connections to a DB, which lowers connection time and can improve load

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

What does the Aurora Data API do?

A

Makes what would normally be stateful connections to a DB available as stateless HTTP API calls

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

Suppose you have a Relational DB that keeps getting throttled with high traffic. What are the ways that you can mitigate this bottleneck?

A
  1. RDS Proxy (connection pooling)
  2. (if Aurora) Aurora Data API (make requests stateless)
  3. (if read-heavy load) Read Replicas (scale out)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do clients authenticate to the Aurora Data API?

A

IAM

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

In the context of AWS

What does LSI stand for?

A

Local Secondary Index

(in DynamoDB)

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

In the context of AWS,

What does GSI stand for?

A

Global Secondary Index

(in DynamoDB)

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

What is the unique identifier in a Dynamo DB table?

A

The Partition Key + Sort Key

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

Why is an LSI considered “local”?

A

LSI only scopes to 1 Partition Key within the DB, and exists physically co-located to the raw data there

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

What consistency model does an LSI use?

A

Strong Consistency

LSI is updated transactionally with raw data

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

What consistency model does a GSI use?

A

Eventual Consistency

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

How do you add an LSI to a Dynamo DB instance after it has been created?

A

You Can’t!

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

What is the maximum number of LSIs allowed per DynamoDB table?

A

5

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

In the context of DynamoDB

What does RCU stand for?

A

Read Capacity Unit(s)

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

In the context of DynamoDB

what does WCU stand for?

A

Write Capacity Unit(s)

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

What are the two different types of DynamoDB capacity structures?

A
  1. Provisioned - Pay for a set number of RCUs and WCUs per second
  2. On-Demand Pay as you go (but higher per RCU/WCU)
20
Q

How can you make sure that Dynamo DB transactions are ACID Compliant (if you need to for your use case)?

A

DynamoDB supports Transactions

21
Q

Does Dynamo DB support conditional writes?

22
Q

What API parameter is used to enforce data integrity with DynamoDB Conditional Writes?

A

The ConditionExpression parameter, used with API calls like PutItem or UpdateItem.

23
Q

In DynamoDB, how do you ensure a new item is created only if it doesn’t already exist?

A

Use the PutItem API with the ConditionExpression: attribute_not_exists(PartitionKey)

24
What are the two DynamoDB API calls used to enforce ACID compliance?
`TransactWriteItems` (for writes/updates) and `TransactGetItems` (for multi-item reads).
25
What does **ACID** stand for?
**A**tomicity **C**onsistency **I**solation **D**urability
26
What are the 2 key advantages of using DAX over other cacheing solutions for DynamoDB?
1. Fully Managed / Minimal Configuration 2. 10x performance increase
27
What type of cache is DAX?
**Write-Through**
28
What DynamoDB feature enables **multi-region, active-active redundancy** with automatic failover and replication?
**Global Tables**
29
What consistency model is enforced for writes across regions in a DynamoDB Global Table?
**Eventually Consistent** replication (typically seconds).
30
What is **Time-to-Live (TTL)** in DynamoDB used for?
To **automatically and asynchronously delete items** from the table after a specified timestamp. ## Footnote effectively managing data lifecycle and reducing storage costs.
31
When an item is automatically deleted by **TTL**, does it generate a record in the DynamoDB Stream?
**Yes**. This allows you to use Lambda to process expired data (e.g., archiving it to S3).
32
How many Partition Keys and Sort Keys can a DynamoDB table have?
**1** Partition Key **0 or 1** Sort Key(s).
33
What is the primary difference in **use case** between a GSI and an LSI?
**The Partition Key** **GSI** is used for alternate query patterns where the new index key is different from the table's key. **LSI** is used for alternate sort patterns _on the same partition key_ as the table.
34
What three API calls are used to read data from a DynamoDB table?
1. `GetItem` (single primary key lookup), 2. `Query` (primary key + optional sort key condition), and 3. `Scan` (full table search/slow).
35
When reading data from DynamoDB, which operation should you avoid for production workloads and why?
**`Scan`** should be avoided because it reads the entire table, consuming large amounts of Read Capacity Units (RCUs) and degrading performance.
36
How is _capacity consumption_ calculated when performing a **Strongly Consistent Read** versus an **Eventually Consistent Read**?
A **Strongly Consistent Read** consumes **2x** the capacity units (2 RCU per 4 KB item) compared to an **Eventually Consistent Read** (1 RCU per 4 KB item).
37
When does DAX effect RCUs to a Dynamo Table?
**Only on a cache miss** ## Footnote When DAX serves a request from its cache (cache hit), no RCUs are consumed. On a cache miss, DAX performs a Strongly Consistent Read on your behalf, consuming 2x the standard RCUs.
38
When does DAX effect WCUs on a DynamoDB table?
**It Doesn't**
39
What is **IAM Database Authentication** in RDS/Aurora?
A security method that allows users/EC2 instances to authenticate to the database using their **IAM credentials** instead of traditional passwords, using **temporary authentication tokens**.
40
What are the two main benefits of using **IAM Database Authentication**?
1. **Enhanced Security**: Credentials are not stored on the host. 2. **Temporary Tokens**: Tokens are valid for only **15 minutes**, reducing the risk of compromised long-lived credentials.
41
What is required on the database side to enable IAM Database Authentication?
The **DB instance must be created with SSL/TLS enabled**, as communication is encrypted.
42
Can you use RDS Proxy with IAM Database Authentication?
**Yes** ## Footnote RDS Proxy is often used in combination with IAM authentication to manage and reuse connections securely.
43
What is the primary purpose of an **Aurora Global Database**?
To provide a **single Aurora database that spans multiple AWS regions**, allowing for **low-latency global reads** and **fast disaster recovery** (RPO and RTO in seconds) due to physical replication.
44
In an Aurora Global Database, what is the consistency model between the primary region and secondary regions?
The replication uses dedicated infrastructure and is **fast, asynchronous physical replication** (typically under a second of lag).
45
What are the two scaling options for Aurora Serverless?
1. **Data API**: For **stateless** access (good for Lambda). 2. **Aurora Serverless v2**: Provides **instantaneous** scaling of compute capacity based on workload, without performance impact.
46
What is the primary benefit of Blue/Green Deployments for RDS/Aurora?
Allows for a **safe and fast switchover** to a new production environment (Green) with **zero downtime** for database changes (e.g., schema updates, engine version upgrades).
47
Which HTTP status code corresponds to the `ProvisionedThroughputExceededException` in DynamoDB?
**400 Bad Request**
48
An application writes data to a DynamoDB table. During peak hours, the application receives ProvisionedThroughputExceededException errors. The developer observes that the consumed write capacity units are well below the provisioned capacity. What is the likely cause?
The application is writing to a 'hot' partition key. ## Footnote If writes are concentrated on a single partition key value, that specific partition can be throttled even if the total table capacity is sufficient.