DynamoDB Flashcards

1
Q

What is DynamoDB

A

A fast and flexible NoSQL database. Serverless. Items stored on SSD storage.

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

Data models that DynamoDB supports

A

Document (JSON, HTML, or XML)

Key_value pairs

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

How many geographic distinct data centers is DynamoDB spread across

A

3

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

Default consistency model of Dynamo DB

A

Eventually Consistent Reads

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

2 types of primary keys DynamoDB supports

A

Partition Key - unique attribute

Composite Key- combo of partition key and sort key

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

IAM Condition you can set to restrict user access to their own records in DynamoDB

A

dynamodb:LeadingKeys

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

What is an index in DynamoDB

A

Way to perform fast queries on colum in table can select column you want to include

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

Local Secondary Index

A

Must be created when create table

Can not be removed or modified after creation

Partition key must be same as original table

Queries are much faster in index than main table

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

Global Secondary Index

A

Can create after table is created

Can edit or delete

Can have different partition key

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

What can you use if you want a query to only return specific attributes DynamoDB?

A

ProjectionExpression

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

How are results sorted DynamoDB?

A

Ascending order

can reverse by setting ScanIndexForward to false

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

How to improve performance of a scan

A

Reduce page size

Avoid using scan if you can

Use parallel scan but try to avoid if table or index is already incurring heavy read and write activity

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

1 X Write Capacity Unit

A

1 x Write of 1 KB/sec

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

1 x Read Capacity Uni

A

1 x Strongly Consistent Read of 4KB/sec

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

1 x Read Capacity Unit

A

2 x Eventually Consistent Read of 4KB/sec

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

DynamoDB Capacity options (2)

A

On-Demand

Provisioned

17
Q

When to use Provisioned Capacity DynamoDB

A

Predicatble app traffic. Traffic is consistent or gradual.

Note you can change provisioned to on-demand once per day.

18
Q

What to use if you want IOX ready performance improvement for heavy read workloads DynamoDB

A

DAX (DynamoDB accelerator)

19
Q

What is DAX?

A

fully managed in-memory cache for DynamoDB.

Uses Write Through Caching.

Eventually Consistent Reads

20
Q

What is DAX not suitable for?

A

Write intensive apps

Want to use Lazy Loading

Strongly Consistent Read apps

Apps that don’t have many reads

21
Q

How to remove irrelevant or old data in DynamoDB

A

Set TTL

Once marked for delete it will be deleted after 48hrs

Can filter out expired items for queries and scans

22
Q

Describe DynamoDB Streams

A

Time-ordered sequence of item level modifications (insert, update, delete)

Logs are encrypted at rest and stored for 24 hrs

Event source for Lambda (perform action when there is a change to the dynamo table)

23
Q

Provisioned ThroughputException

A

Request rate too high for read/write capcity in DynamoTable

SDK auto retries till successful

If not using SDK (reduce request frequency, use exponential backoff)

24
Q

Exponential Backoff

A

Progressively longer wait between consecutive retries

50ms, 100ms, 200ms

If that doesn’t work it could be request size is exceeding throughput for read write capacity.

25
Q

Scenario: Need to ensure all data in DynamoDB is encrypted using an AWS owned key. What can you do to ensure this?

A

Don’t need to do anything. By default all Dynamo tables are encrypted at rest with AWS owned key

26
Q

What should you use if you need to perform a write operation on a sequence of items, and roll back and reverse all operations in case of any faulty operation?

A

TransactWriteItems

27
Q

First recommended way to handle ProvisionedThroughputExceeded error

A

Ensure app is using exponential backoff

28
Q

What strategy can you use to decrease size of read operations and increase read efficiency when calling GetItem in DynamoDB

A

Use a Projection Expression

29
Q

How to filter results returned by a scan operation.

A

Use a Filter Expression

30
Q

If want to protect database writes from being overwritten by other write operations that happen at the same time by multiple users what should you implement?

A

Optimistic locking with version number

31
Q

How to easily count number of people using your website with DynamoDB?

A

atomic counter

32
Q

What to set ReturnConsumedCapactiy to to recieve total number of write capacity units consumed?

A

TOTAL

33
Q

What to set ReturnConsumedCapactiy to to recieve total number of write capacity units consumed and subtotals for any secondary indexes?

A

INDEXES

34
Q

Data types allowed for partition and sort keys in DynamoDB

A

Number, String, Binary

35
Q

Max size of item in DynamoDB

A

400KB