API Gateway & Dynamo DB Flashcards

1
Q

Can you use mapping templates when you have the proxy setting enabled?

A

No

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

What is the difference between provisioned and on-demand mode for DynamoDB?

A

Provisioned (default) - you specify the number of reads/writes per second, plan capacity beforehand, pay for provisioned units.

On-demand - read/writes automatically scale with your workloads. No planning needed but more expensive.

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

What is one write capacity unit (WCU) in DynamoDB?

A

Represents one write per second for an item up to 1KB in size (rounded up to the nearest whole KB)

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

Work out the number of write capacity units needed to write 6 items per second into DynamoDB each with a size of 1.5KB

A

6 x 2 = 12 1.5KB would be rounded up to 2KB (because amazon are money greedy bastards)

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

Work out the number of write capacity units needed to write 120 items per minute into DynamoDB each with a size of 2KB

A

120/60 x 2 = 4

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

What are the two “modes” for reading items from DynamoDB (in the context of consistency)

A

Eventually consistent read (default) - if we read straight after a write we might get stale data as replication may not complete in time.

Strongly consistent read - reading always up-to-date data, this is done via a parameter in the api call, consumes twice the RCU (read capacity units).

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

What does one read capacity unit represent in DynamoDB?

A

Represents one strongly consistent read per second or two eventually consistent reads per second, for an item up to 4KB in size.

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

Work out the number of read capacity units for 10 strongly consistent reads per second, with an item size of 4KB

A

10 RCUs

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

Work out the number of read capacity units for 16 eventually consistent reads per second with an item size of 12KB

A

We need (16/2) x (12kb / 4kb) = 24 RCUs

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

What is the difference between the PutItem and UpdateItem api calls to DynamoDB?

A

PutItem creates or replaces an item (based on primary key) whereas UpdateItem edits a subset of an existing items attributes.

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

What is the most efficient way to delete all the items in a DynamoDB table?

A

Use the DeleteTable api call, do not use the DeleteItem with a scan

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

In DynamoDB when using batch operations what happens if one operation in a batch fails?

A

The whole batch does not roll back, just the parts that failed are returned as failed, the client can then retry just those failed operations.

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

What is PartiQL?

A

SQL compatible query language for DynamoDB (without joins)

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

What is DynamoDB Accelerator (DAX)?

A

In memory cache for DynamoDB

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

What can be cached in a DAX?

A

Individual objects, queries / scans

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

When might you use ElastiCache instead of DAX?

A

Storing the result of computed data

17
Q

What are DynamoDB Streams?

A

Ordered stream of item-level modifications (create/update/delete) in a table

18
Q

Where can DynamoDB Streams be sent?

A

Kinesis Data Streams, Lambda, Kinesis Client Library apps

19
Q

When DynamoDB automatically deletes an item that had a TTL attribute set are any WCUs consumed?

A

No, no extra cost

20
Q

How quickly do expired DynamoDB items (using TTL) get deleted?

A

Within 48 hours

21
Q

When using transactions in DynamoDB how many more capacity units are used?

A

Twice as many

22
Q

Work out how many WCUs are needed for 3 transactional writes per second, with an item size of 5Kb

A

3 x (5Kb / 1Kb) x 2 (transactional cost) = 30WCUs

23
Q

Work out how many RCUs are needed for 5 transactional reads per second, with an item size of 8Kb

A

5 x (8Kb / 4Kb) x 2 (transactional cost) = 20RCUs

24
Q

What is the difference between using DynamoDB vs ElastiCache as session state cache (user logins)

A

ElastiCache is in memory. DynamoDB is serverless and auto scales. Both are key/value stores.

25
Q

What two ways can you copy a DynamoDB table?

A

Use an AWS data pipeline (via an S3 bucket) or backup and restore into a new table

26
Q

What is the maximum size of an item in a DynamoDB table?

A

400KB

27
Q

You would like to query a DynamoDB table using an attribute that is not part of your tables primary key. What should you do to make this query efficient?

A

Create a global secondary index

28
Q

You are designing a new DynamoDB table where you want to make a query using an attribute that is not part of your tables primary key. You need to use the >= predicate while keeping the same partition key. What should you do to make this query efficient? Nothing, create a local secondary index or create a global secondary index?

A

Create a local secondary index

29
Q

What CLI option should you use to restrict the number of entries returned from a DynamoDB get call?

A

–max-items (and –starting-token if paganating)

30
Q
A