Top 25 DynamoDB Interview Questions & Answers 
Written by Nishani Dissanayake
Published on March 8th, 2022
Time to 10x your DynamoDB productivity with Dynobase [learn more]
Q1. What is DynamoDB?
DynamoDB is a fully managed NoSQL database service. It is backed by AWS and provides exciting features like seamless scalability, fast performance, and high reliability over data. DynamoDB supports both key-value and document data structures. In addition, this service comes with different pricing tiers to suit varying user requirements.
DynamoDB is quite effective at data storing and retrieval in all traffic levels and allows the users to create tables for the database.
02. What are NoSQL databases?
NoSQL or non-relational databases focus on different data storing models rather than a tabular structure. There are four types of NoSQL databases:
- Key-value stores
- Document stores
- Graph store
- Colum stores
DynamoDB supports both document and key-value structures.
03. What are the key features of DynamoDB?
- Highly Scalable without any intervention from the user.
- It has a latency of microseconds.
- Serverless and enterprise-ready.
- Encryption at Rest.
- On-demand backup and restore.
- Point-in-time recovery.
Read more: DynamoDB Features.
04. What are the advantages of using DynamoDB?
- We can store any amount of data with the unlimited storage provided by the DynamoDB service.
- The data we store replicates over many availability regions. It allows to easily cope with global-scale applications and make sensitive information highly available.
- It is highly cost-effective, and the users have to pay only for what they use.
- Easy administration and the user doesn't have to worry about software patching, setup, and configuration because AWS fully manages DynamoDB.
- DynamoDB has an advanced system for reporting and highly secured user authentication mechanisms to provide maximum security over sensitive data.
Read more: DynamoDB Pros & Cons.
05. What are the disadvantages of DynamoDB?
- No triggers and lack server-side scripts.
- No table joins possible.
- Data querying is highly limited.
- The cost can be unpredictable with spikes in usage.
06. What are the use cases of DynamoDB?
- Daily web analytics
- Real-time analytics
- Data warehousing
- Business Intelligence
07. What is DynamoDBMapper?
The DynamoDBMapper class is an entry point that allows access to DynamoDB endpoints, enabling users to handle the database. Users can perform CRUD operations, run queries, and scan against tables. And this class is only available for Java.
Read more: DynamoDBMapper.
08. What is meant by Partition Key in DynamoDB?
A partition key is a primary key composed of only a single attribute. In DynamoDB, the value of the partition key work as the input for internal hash functions. The resulting output from that function helps determine the partition to store the item in question.
09. How does DynamoDB Query functionality work?
DynamoDB provides 2 options to fetch data from collections as Query and Scan. When using Scan, DynamoDB will look through the complete table for records with matching criteria, while Query uses key constraints to perform a direct lookup for a particular data set.
In addition to the primary key, DynamoDB uses global secondary key, local secondary key, and partition primary key to help improve flexibility and improve the read/ write operation speed.
As a result, it is fast and time effective compared to the DynamoDB Scan operation and is recommended for most data fetching scenarios.
10. What are the key differences between Amazon DynamoDB and Amazon Aurora?
- DynamoDB is NoSQL, whereas Aurora is a relational database service.
- Aurora uses SQL for data manipulation and fetching, whereas DynamoDB uses a specialized syntax.
- Aurora uses horizontal partitioning, whereas DynamoDB uses sharding as the partitioning method.
- DynamoDB implements key-value and document models where Aurora operates with relational DBMS.
- Aurora supports server-side scripting, but DynamoDB does not.
Read more: DynamoDB vs. Aurora.
11. List 5 ways to fetch data from DynamoDB
12. What are DynamoDB Projections?
As its name suggests, the attributes in a table projected to the index are the projections. (Similar to the GROUP BY operation in SQL). Projections can exclude all the unnecessary items and reduce the overall size of the payload returned by the API.
We have to define the projected attributes each time we create a local secondary index. Each index must have minimally three attributes: table partition key, index sort key, and table sort key.
Read more: DynamoDB Projections.
13. How does DynamoDB prevent data loss?
There is long-term storage and a two-tier backup system in DynamoDB to keep data loss at a minimal level. There are three nodes for each participant, and each node contains the same data from the partition. In addition, there is a B tree for data location and a replication log to track the changes in each node. DynamoDB stores snapshots of these and stores them in another AWS database for a month for data restoration when necessary.
14. Does DynamoDB support in-place atomic updates?
DynamoDB supports quick in-place atomic updates enabling users to add or remove values to sets or lists at the atomic level using Transactions.
15. What are DynamoDB Streams?
DynamoDB Streams allow capturing the time-ordered sequence of item-level modifications made to a DynamoDB table. This information saves in a log for 24 hours, and each modification made to the database records sequentially to the modification order.
Read more: DynamoDB Streams.
16. What are the DynamoDB pricing tiers?
- On-demand capacity mode: This pricing tier focuses on the incoming traffic to the application and scales the database instance based on that. This pricing tier is ideal when the traffic is not predictable.
- Provisioned capacity mode: This pricing tier lets users specify the reads and writes per second or choose auto-scaling. This option works best when the traffic is consistent and predictable.
Read more: DynamoDB Pricing.
17. What is the maximum item size in Amazon DynamoDB?
Including both the attribute name length and the value lengths in binary format, 400KB is the maximum item size.
18. What is DynamoDB Auto Scaling?
Most of the time, it is hard to tell beforehand about the database's workload. So, DynamoDB introduced DynamoDB Auto Scaling to scale the read and writes capacity in response to the traffic.
Scaling up allows the tables or the global secondary indexes to gain more read and write. Whereas scaling down automatically based on the traffic makes DynamoDB cost-effective to use.
19. What is the DynamoDB Local?
DynamoDB Local is a downloadable version of DynamoDB. It allows developing and testing applications in the local environment without using the DynamoDB web service. Once the application is ready for deployment, the local endpoint can be changed and redirected to the DynamoDB web service.
20. How many Global Secondary Indexes can you create on a single table?
Up to 20 Global Secondary Indexes.
21. What is Encryption at Rest?
Encryption at Rest is a security mechanism DynamoDB uses to protect sensitive data. This database service uses the AWS KMS (AWS Key Management Service) keys to encrypt all the data at rest. There are three types of AWS KMS keys to select from:
- AWS owned key
- AWS managed key
- Customer managed key
Read more: Encryption at Rest.
22. What is DynamoDB Accelerator?
DAX (Amazon DynamoDB Accelerator) is a type of in-memory cache. Even when it is millions of requests per second, DynamoDB Accelerator provides a performance up to 10 times the original rate. In addition, it is fully managed and is highly available.
Read more: DAX.
23. What are DynamoDB Global Tables?
DynamoDB Global Tables allow users to replicate their data over different regions of choice. That makes the data highly available and quickly delivered across global applications of enormous size. Every data write made to a global table is replicated over all the regions having replicas of the same table.
24. What does BatchGetItem do in DynamoDB?
BatchGetItem allows retrieving attributes of one or more items from one or more tables using the primary key. There is a limitation of 16MB up to which this operation can return items.
Read more: BatchGetItem.
25. What are Indexes and Secondary Indexes in DynamoDB?
An index is a data structure that enhances the data retrieval speed from the database. However, it costs some storage space and additional writes to the database to maintain the index data structure.
DynamoDB has two types of indexes:
- Global secondary index
- Local secondary index
Secondary indexes allow to storage of a sub-group of attributes from a table. With that, it supports query functionality with alternate keys.
This article discussed 25 of the top questions you may face about DynamoDB in an interview. DynamoDB is a developing technology becoming a huge asset amongst the NoSQL database services. Because of that, positions are opening up for individuals passionate about working with this fantastic service.
So, I hope you find this article helpful to crush your next interview with confidence!
© 2022 Dynobase