DynamoDB Flashcards

1
Q

Write Capacity Unit (WCU)

A

One write per second for an item up to 1 KB in size (round up to nearest 1 KB)

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

To write 10 items per second, with item size 2 KB, how many WCU’s are needed?

A

20 WCUs

10 * (2KB/1KB) = 20

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

To write 6 items per second, with an item size 4.5 KB, how many WCU’s are needed?

A

30 WCUs

6 * (5/1) = 30

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

To write 120 items per minute, with item size 2 KN, how many WCUs are needed?

A

4 WCUs

(120/60) * (2KB/1KB) = 4 WCUs

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

Read Capacity Unit (RCU)

A

One Strongly Consistent Read per second, or
Two Eventually Consistent Reads per second,
for an item up to 4 KB in size (round up to nearest 4 KB)

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

10 strongly consistent reads per second, with item size 4 kb

A

10 RCUs

10 * (4 kb/ 4 kb) = 10 RCUs

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

16 eventually consistent reads per second, with item size 12 kb

A

24 RCUs

(16 / 2) * (12 kb / 4kb) = 24 RCUS

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

10 strongly consistent reads per second, with item size 6 kb

A

20 RCUs

10 * (8 kb / 4 kb) = 20 RCUs

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

Before you create a DynamoDB table, you need to provision the EC2 instance the DynamoDB table will be running on.

A. True
B. False

A

B. False

DynamoDB is serverless with no servers to provision, patch, or manage and no software to install, maintain or operate. It automatically scales tables up and down to adjust for capacity and maintain performance. It provides both provisioned (specify RCU & WCU) and on-demand (pay for what you use) capacity modes

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

You have provisioned a DynamoDB table with 10 RCUs and 10 WCUs. A month later you want to increase the RCU to handle more read traffic. What should you do?

A. Increase RCU and keep WCU the same
B. You need to increase both RCU and WCU
C. Increase RCU and decrease WCU

A

A. Increase RCU and keep WCU the same

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

You have an e-commerce website where you are using DynamoDB as your database. You are about to enter the Christmas sale and you have a few items which are very popular and you expect that they will be read often. Unfortunately, last year due to the huge traffic you had the ProvisionedThroughputExceededException exception. What would you do to prevent this error from happening again?

A. Increase the RCU to a very high value
B. Create a DAX cluster
C. Migrate the database away from DynamoDB for the time of the sale

A

B. Create a DAX cluster

DynamoDB Accelerator (DAX) is a fully managed, highly available, in-memory cache for DynamoDB that delivers up to 10x performance improvement. It caches the most frequently used data, thus offloading the heavy reads on hot keys of your DynamoDB table, hence preventing the “ProvisionedThroughputExceededException” exception.

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

You have developed a mobile application that uses DynamoDB as its datastore. You want to automate sending welcome emails to new users after they sign up. What is the most efficient way to achieve this?

A. Schedule a Lambda function to run every minute using CloudWatch Events, scan the entire table looking for new users
B. Enable SNS and DynamoDB integration
C. Enable DynaboDB Streams and configure it to invoke a Lambda function to send emails

A

C. Enable DynaboDB Streams and configure it to invoke a Lambda function to send emails

DynamoDB Streams allows you to capture a time-ordered sequence of item-level modifications in a DynamoDB table. It’s integrated with AWS Lambda so that you create triggers that automatically respond to events in real-time.

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

You are running an application in production that is leveraging DynamoDB as its datastore and is experiencing smooth sustained usage. There is a need to make the application run in development mode as well, where it will experience an unpredictable volume of requests. What is the most cost-effective solution that you recommend?

A. Use Provisioned Capacity Mode with Auto Scaling enabled for both development and production
B. Use provisioned Capacity Mode with Auto Scaling enabled for production and use On-Demand Capacity Mode for development
C. Use Provisioned Capacity Mode with Auto Scaling enabled for development and use On-Demand Capacity Mode for production
D. Use On-Demand Capacity Mode for both development and production

A

B. Use provisioned Capacity Mode with Auto Scaling enabled for production and use On-Demand Capacity Mode for development

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

The maximum size of an item in a DynamoDB table is ____

A. 400 KB
B. 500 KB
C. 400 MB
D. 1 MB

A

A. 400 KB

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

DynamoDB tables scale ____

A. Vertically
B. Horizontally

A

B. Horizontally

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

When your DynamoDB table’s Primary Key is a combination of Partition Key + Sort Key, then _____ must be unique.

A. Partition key + Sort key
B. Partition key

A

A. Partition key + Sort key

17
Q

You have taken the decision to use DynamoDB as the database for a blog posts website. While designing the blog posts table, which column should you use as the Partition Key for optimal distribution?

A. author_id
B. blog_content
C. blog_id
D. blog_date

A

C. blog_id

18
Q

An application writes 12 items per second into a DynamoDB table, with each item 8 KB in size. What WCU should you choose?

A. 12
B. 24
C. 48
D. 96

A

D. 96

12 * (8 KB / 1 KB) = 96 WCU.

19
Q

An application doing Strongly Consistent reads of 10 items per second, with each item 10 KB in size. What RCU do you choose?

A. 100
B. 30
C. 20
D. 25

A

B. 30

10 KB gets rounded to 12 KB. 10 * (12 KB / 4 KB) = 30 RCU.

20
Q

An application doing Eventually Consistent reads of 12 items per second, with each item 16 KB in size. What RCU do you choose?

A. 192
B. 48
C. 24
D. 12

A

C. 24

We can do 2 Eventually Consistent reads per seconds for items of 4 KB with 1 RCU. 12 * (16 KB / 4 KB) = 48 / 2 = 24 RCU.

21
Q

An application begins to receive a lot of ProvisionedThroughputExceededException exceptions from a DynamoDB table that you manage. After checking the CloudWatch metrics, you found that you haven’t exceeded the total provisioned RCU. What is a possible cause for this?

A. Everything is good, just the CloudWatch metrics are slow to update
B. You have a Hot Partition / Hot Key
C. There’s a bug in the application code

A

B. You have a Hot Partition / Hot Key

Remember RCUs and WCUs are spread across all the table’s partitions.

22
Q

You are using GetItem API call to retrieve items from a DynamoDB table. Which of the following allows you to select only certain attributes from the item?

A. FilterExpression
B. ConditionalWrite
C. ProjectionExpression

A

C. ProjectionExpression

23
Q

What is the best way to delete all the data in a DynamoDB table?

A. DeleteTable and then CreateTable
B. Use Scan and rune BatchWriteItem
C. Use Scan and run DeleteItem

A

A. DeleteTable and then CreateTable

24
Q

You want to perform a Scan operation on a DynamoDB table to retrieve all the items. What should you do to increase the performance of your scan operation?

A. Increate the Limit parameter
B. Use Parallel scans
C. Use Sequential scans
D. Increase the RCU

A

B. Use Parallel scans

25
Q

You would like to make a Query to a DynamoDB table using an attribute that’s NOT part of your table’s Primary Key. What should you do to make this query efficient?

A. Nothing, Query supports non-key attributes
B. Create a Local Secondary Index
C. Create a Global Secondary Index

A

C. Create a Global Secondary Index

26
Q

You are working on designing a new DynamoDB table where you want to make a Query using an attribute that’s NOT part of your table’s Primary Key. You need to use the >= predicate while keeping the same Partition Key. What should you do to make this query efficient?

A. Nothing, use Query as is
B. Create a Local Secondary Index
C. Create a Global Secondary Index

A

B. Create a Local Secondary Index

27
Q

Which Concurrency Model can be implemented using DynamoDB?

A. Optimistic locking
B. Pessimistic locking
C. No locking

A

A. Optimistic locking

28
Q

Which feature of DynamoDB allows you to achieve Optimistic Locking?

A. Conditional reads
B. Conditional writes
C. Locked reads
D. Locked writes

A

B. Conditional writes

29
Q

You have an application running for over a year now using a DynamoDB table, with Provisioned RCUs and WCUs, without any throttling issues. There’s a requirement for your table to support second type of queries, so you have decided to use the existing Local Secondary Index (LSI) and create a new Global Secondary Index (GSI) to support these queries. One month later, the table begins to experience throttling issues. After checking the table’s CloudWatch metrics, you found that you haven’t exceeded the table’s Provisioned RCU and WCU. What should you do?

A. The LSI is throttling so you need to provision more RCU and WCU to the LSI
B. Adding both an LSI and a GSI to a table is not recommended by AWS best practices as this is a known cause for creating throttles
C. The GSI is throttling so you need to provision more RCU and WCU to the GSI
D. CloudWatch metrics take time to propagate, you should see the RCU and WCU peaking for the main table in a few minutes

A

C. The GSI is throttling so you need to provision more RCU and WCU to the GSI

Global Secondary Index (GSI) uses an independent amount of RCU and WCU and if they are throttled due to insufficient capacity, then the main table will also be throttled.

30
Q

Which feature in DynamoDB allows you to automatically delete expired items from the table?

A. TTL
B. DynamoDB Streams
C. DynamoDB Accelerator (DAX)
D. Global Secondary Index (GSI)

A

A. TTL

31
Q

Which of the following AWS CLI options allows you to retrieve a subset of the item’s attributes coming from a DynamoDB Scan operation?

A. –filter-expression
B. –page-size
C. –max-items
D. –projection-expression

A

D. –projection-expression

32
Q

You would like to paginate the results of a DynamoDB Scan operation in order to minimize the number of items returned in the CLI’s output. Which of the following AWS CLI options should you use?

A. –page-size & –max-items
B. –page-size & –starting-token
C. –max-items & –starting-token
D. –filter-expression

A

C. –max-items & –starting-token

33
Q

You are developing a banking application that uses DynamoDB to store its data. You want to update both the Exchanges and the AccountBalance tables at the same time or not at all. Which DynamoDB feature allows you to do so?

A. DynamoDB Indexes
B. DynamoDB Transactions
C. DynamoDB Streams
D. DynamoDB TTL

A

B. DynamoDB Transactions

34
Q

DynamoDB Streams records can be sent to the following, EXCEPT _____

A. Simple Queue Service (SQS)
B. Kinesis Data Streams
C. AWS Lambda

A

A. Simple Queue Service (SQS)

35
Q

You have configured a DynamoDB table with a TTL attribute to delete expired user’s sessions, but you noticed that some expired items still exist in queries you make. What should you do to resolve this problem?

A. Do nothing. DynamoDB automatically deletes expired items within 48 hours of the expiration
B. This is a known bug in DynamoDB. Use a Lambda function to periodically delete the expired items
C. Contact AWS support to periodically delete expired items

A

A. Do nothing. DynamoDB automatically deletes expired items within 48 hours of the expiration