DynamoDB Flashcards

1
Q

Eight things about DynamoDB?

A
  • Fully managed
  • Multi-region
  • Multi-master
  • Durable
  • Built-in security
  • Backup and restore
  • In-memory caching
  • Data is stored across multiple AZs
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the 2 types of reads that DynamoDB provides?

A
  • Strongly Consistent Reads

- Eventually Consistent Reads (Default)

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

The Key Value and Document database solution for AWS

A

DynamoDB (NoSQL)

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

What are the 3 components of a DynamoDB table?

A
  • Keys
  • Values
  • Attributes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How many partitions does a DynamoDB database start off with?

A

1

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

How large can a single DynamoDB partition be? (GB)

A

10GB

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

The maximum read and write capacity units for a single DynamoDB partition

A

3000 Read Capacity Units, 1000 Write Capacity Units

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

These 2 components make up a composite primary key in DynamoDB

(kəmˈpɑzət)

A

Partition Key & Sort Key

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

In Dynamo DB, When using a simple primary key how many items can have the same partition key?

A

1

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

In Dynamo DB, What additional key component makes a primary key composite?

A

Sort key

  • (The combination of the partition and the sort has to be unique) There is a secret internal hash function that decides which partition to write data
  • New data is added into a partition with similar data, Eg. a category
  • Partition Key: Category
  • Sort Key: Name
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

In Dynamo DB, with composite keys multiple items share the same partition key (as long as their sort keys are different)
True or False

A

True.

  • Partition Key: Country
  • Sort Key: Citiy
Partition A:
VE - CCS
VE - MCBO
Partition B:
CL - STGO
CL - CONCE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In Dynamo DB, The 2 methods of retrieving items from a DynamoDB table

A

Query & Scan

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

In Dynamo DB, By default what item attributes does a query return?

A

All attributes

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

This DynamoDB item retrieval method finds items based on primary key values.

A

Query

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

This DynamoDB item retrieval method checks all items, then returns one of more item using filters

A

Scan

  • Scans are one of the most expensive ways to access data in DynamoDB
  • Scans can be Slow
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

In Dynamo DB, which method do you have to avoid because it retrieves everything.
It’s much less efficient than running the other one

A

Scan

  • Scans are one of the most expensive ways to access data in DynamoDB
  • Scans can be Slow
17
Q

With DynamoDB the maximum amount of capacity your application is allowed to read or write per second from a table or index is called this. (The name of the capacity)

Read/Write capacity mode: ___

A

Provisioned Throughput Capacity
(prəˈvɪʒənd ˈθruˌpʊt kəˈpæsəti)

Provisioned

  • RCUs
  • WCUs

We can turn on Auto Scaling

Requests that are throttled will be dropped (data lost)

18
Q

With this DynamoDB capacity type you only pay per request - so you are only paying for what you use

Read/Write capacity mode: ___

A

On-Demand Capacity

  • Provisioned capacity not applicable
  • Auto Scaling not applicable

New tables with unknown workloads, unpredictable application traffic

Default upper limits for a table
40,000 RCUs
40,000 WCUs

  • Since there is no hard limit On-Demand could become very expensive based on emerging scenarios
19
Q

In DynamoDB,

What are the 3 requirements for creating a Global Table?

A
  • KMS CMK
  • Enable Streams
  • StreamViewType (What info is going to be written to the stream)KEYS_ONLY - Only the key attributes of the modified item are written to the stream.NEW_IMAGE - The entire item, as it appears after it was modified, is written to the stream.OLD_IMAGE - The entire item, as it appeared before it was modified, is written to the stream.NEW_AND_OLD_IMAGES - Both the new and the old item images of the item are written to the stream.
20
Q

How many underlying reads or writes does DynamoDB perform on every item in a transaction?

A

2

  • One to prepare the transaction
  • One to commit the transaction
21
Q

The 2 operations for performing transactions with DynamoDB

A
  • TransacWriteItems

- TranscGetItems

22
Q

Which format must you provide your TTL value in?

A

To use TTL you must use a string which needs to be In Epoch format (Datetime represented as numbers)

(ˈipək) format

23
Q

What is TTL in DynamoDB?

A

Time To Live
- It’s great for keeping databases small and manageable because some data is deleted when it expires
Eg: Session data, Usage Patterns, Some logs

24
Q

In DynamoDB this value specifies when an item should expire/delete itself

A

Time To Live (TTL) Value

25
Q

Enabling this DynamoDB feature on a table will capture every modification to data items so you can react those changes.

A

DynamoDB Streams

- It doesn’t not consume RCU

26
Q

Which of the following is true about DynamoDB streams?

There are three answers:

A
  • Changes are sent in batches at a time
  • Changes are sent to Lambda in near real-time
  • It doesn’t consume RCU’s
27
Q

Which of the following are common errors for DynamoDB?

..Exception
.. .. …Exception

A
  • ThrottlingException (ˈθrɑtəlɪŋ ɪkˈsɛpʃən)

This exception might be returned if you perform control plane API operations too rapidly. (CreateTable, UpdateTable, ListTables)

For tables using on-demand mode, this exception might be returned for any data plane API operation if your request rate is too high. (CRUD actions on data in a table)

  • ProvisionedThroughputExceededException

Your request rate is too high. The AWS SDKs for DynamoDB automatically retry requests that receive this exception. Your request is eventually successful, unless your retry queue is too large to finish. Reduce the frequency of requests using Error Retries and Exponential Backoff.

28
Q

The 2 types of secondary indexes available for DynamoDB.

ˈsɛkənˌdɛri

Which Should you use generally?

A
  • LSI - Local Secondary Index
    > With initial table (After creation, nothing to do)
    > It provides strong consistency
    > It can’t exceed 10GB (It’s per partition)
    > Composite keys
- GSI Global Secondary Index
 > Generally use this
 > Queries on the index can span all of the data across all partition
 > Maximum 20 per table
 > Eventual consistency reads
29
Q

What are some scenarios would be ideal to consider DAX?
(sɪˈnɛrioʊz)

There are two scenarios in the list

A

It is a fully managed, highly available, in-memory cache for Amazon DynamoDB

  1. Apps requiring the fastest possible response time for reads
    > Real-time bidding, social gaming
  2. Apps that read a small number of items more frequently than others
30
Q

This DynamoDB enhanced feature provides a fully managed in memory cache that runs in a cluster

enhanced

A

DynamoDB Accelerator (DAX)

31
Q

What do DynamoDB Transactions let you do?

A

Query multiple tables at once and is an all-or-nothing approach

32
Q

In DynamoDB, How do you calculate RCU?

A

Strong = (KB p.item) / 4 * (desirable RCU)

Eventual = ((KB p.item) / 4 * (desirable RCU)) /2

33
Q

In DynamoDB, How do you calculate WCU?

A

(KB) * Desired

  • round 1.5kb to 2kb
  • round 500bytes to 1kb
34
Q

In DynamoDB

If you don’t need DAX, please consider…

A

ElastiCache

ɪˈlæstɪ-kæʃ

35
Q

In DynamoDB
aws dynamodb
- It returns a set of attributes for new item with given primary key
- It creates a new item (If the id exists, it replaces the old element)
- It edits an existing item’s attributes
- It returns the attributes of one or more items from one or more tables (Up tp 16mb and 100 items)
- It puts or deletes multiple items in one or more tables (25 put or delete requests)
- It adds a new table to your account
- It modifies the provisioned throughput settings, secondary index
- It Deletes a table and all of its items
- A synchronous operation that atomically retrieves multiple items from one or more tables (25 objects < 4mb)
- A synchronous write operation that groups up to 25 action requests
- It finds items based on primary key values
- It returns one or more items and items attributes by accessing every item

A
> get-item
> put-item
> update-item
> batch-get-item
> batch-write-item
> create-table
> update-table
> delete-table
> transact-get-items
> transact-write-items
> query
> scan
36
Q

What is Dynamo DB?

What are its 13 elements?

A
  • It’s a key-value and document NOSQL database
  • Consistency types (Eventually…)
  • Data types (Binary, Number, String)
  • Tables anatomy (Items, attributes)
  • Partitions
  • Types of Primary Key (Simple, composite)
  • Global tables
  • Transactions (TransacGetItems…)
  • Streams (Trigger lambda functions)
  • Secondary indexes (GSI, LSI)
  • Types of operation searches (Query, Scan)
  • Capacity Modes (Provisioned, On-Demand)
  • Calculate reads and writes
  • DAX
37
Q

How do you reduce the frequency of failed requests to avoid ProvisionedThroughputExceeded on DynamoDB?

A

Error Retries and Exponential Backoff.

The idea behind exponential backoff is to use progressively longer waits between retries for consecutive error responses. You should implement a maximum delay interval, as well as a maximum number of retries. The maximum delay interval and maximum number of retries are not necessarily fixed values, and should be set based on the operation being performed, as well as other local factors, such as network latency.

38
Q

In order to give you the ability to retrieve data from your DynamoDB tables more rapidly you need to use:
Two elements in the answer

A
  • Parallel Scans

- limiting the rate