Amazon DynamoDB Interview Questions
Here are some AWS certification interview questions and answers on Amazon DynamoDB
1. What is Amazon DynamoDB?
Amazon DynamoDB is a fully-managed NoSQL database service provided by AWS. It is designed to provide seamless and scalable performance with high availability and durability. DynamoDB is ideal for applications that require low latency and high throughput.
2. What is the difference between DynamoDB and RDS?
DynamoDB is a NoSQL database that is fully managed and is designed to provide low latency and high throughput, while RDS is a relational database service that allows you to run various types of relational databases on AWS.
3. What is the maximum item size in DynamoDB?
The maximum item size in DynamoDB is 400KB.
4. What is a partition key in DynamoDB?
A partition key in DynamoDB is a unique identifier that is used to distribute data across multiple nodes in a DynamoDB table.
5. What is a sort key in DynamoDB?
A sort key in DynamoDB is used to sort items with the same partition key. It is used to provide efficient querying of data within a single partition.
6. What is the difference between a partition key and a composite key in DynamoDB?
A partition key is a simple primary key that is used to partition data across multiple nodes in DynamoDB. A composite key, on the other hand, is a combination of a partition key and a sort key. It is used to allow for more complex querying of data within a single partition.
7. What are DynamoDB Streams?
DynamoDB Streams is a feature of DynamoDB that allows you to capture changes to data in a table in near real-time. You can use these streams to trigger AWS Lambda functions or send updates to other services.
8. What is Global Secondary Index in DynamoDB?
A global secondary index (GSI) in DynamoDB is an index that contains a partition key and a sort key, just like the main table. However, the GSI uses a different partition key than the main table, allowing you to query data in new ways.
9. What is the difference between Strongly Consistent Reads and Eventually Consistent Reads in DynamoDB?
Firmly Consistent Reads in DynamoDB ensure that you always receive the most up-to-date data when you read from the database. Eventually, Consistent Reads, on the other hand, allows for more efficient data querying by allowing for some lag time in retrieving the most up-to-date data.
10. How does DynamoDB handle scaling?
DynamoDB is designed to scale automatically to handle increasing workloads. As the amount of data in a table increases, DynamoDB will automatically split the data across multiple nodes to provide scalable performance. You can also increase the capacity of your table on demand to handle sudden spikes in traffic.
11. What is the minimum and maximum throughput capacity of a DynamoDB table?
The minimum throughput capacity of a DynamoDB table is one read capacity unit and one write capacity unit. The maximum throughput capacity of a table is determined by the account limits and can be increased through a support request.
12. What is the difference between Provisioned Throughput and On-Demand Capacity Mode in DynamoDB?
Provisioned Throughput is a method of reserving capacity for a DynamoDB table in advance, which provides predictable performance and cost. On-Demand Capacity Mode, however, allows you to pay for only the capacity you use without any upfront commitment.
13. What are the benefits of using DynamoDB Accelerator (DAX)?
DynamoDB Accelerator (DAX) is a fully-managed, in-memory cache for DynamoDB that provides faster access to frequently accessed data. It can reduce the read latency of DynamoDB queries from milliseconds to microseconds, resulting in faster application performance.
14. What is a Hot Partition in DynamoDB and how do you avoid it?
A Hot Partition is a partition in a DynamoDB table that receives a disproportionately high amount of traffic, resulting in degraded performance for that partition. To avoid Hot Partitions, you can use random partition keys, sharding, or a composite key with multiple partition keys.
15. What is the TTL feature in DynamoDB?
The Time to Live (TTL) feature in DynamoDB allows you to specify a time after which expired items will be deleted automatically from a table. This can be used to manage storage costs and to automatically delete data that is no longer needed.
16. How does DynamoDB handle backups and restores?
DynamoDB provides two types of backups: on-demand backups and continuous backups. On-demand backups allow you to create backups of your table at any time, while continuous backups provide automatic backups at a specified time interval. To restore a backup, you can use the AWS Management Console or the AWS CLI.
17. What is DynamoDB Transactions and how does it work?
DynamoDB Transactions provide atomic, consistent, isolated, and durable (ACID) transactions for multiple item updates. Transactions can be used to ensure that a group of updates are applied together, or that they are all rolled back in case of a failure.
18. What is the difference between DynamoDB and Amazon DocumentDB?
DynamoDB is a fully-managed NoSQL database service provided by AWS, while Amazon DocumentDB is a fully-managed document database service that is compatible with MongoDB. DynamoDB is designed for low latency and high throughput, while DocumentDB is designed for high availability and durability.
19. What are the different datatypes supported by DynamoDB?
DynamoDB supports a number of data types including strings, numbers, binary data, sets, and documents. It also supports data types for dates, time, and timestamps.
20. How can you monitor and optimize performance in DynamoDB?
DynamoDB provides several tools for monitoring and optimizing performance, including CloudWatch Metrics, DynamoDB Streams, and DynamoDB Accelerator (DAX). You can also use best practices such as sharding and using partition keys effectively to optimize performance.
21. What is a Global Secondary Index (GSI) in DynamoDB?
A Global Secondary Index (GSI) is a separate index that you can create on a DynamoDB table, which enables you to query the table using an alternate partition key and sort key. A table can have up to 20 GSIs.
22. How does DynamoDB handle data replication and durability?
DynamoDB stores three copies of your data in different availability zones to ensure durability and availability. When you write data to DynamoDB, it is written to a primary replica and then propagated to the other replicas asynchronously.
23. What is the difference between a Strongly Consistent Read and an Eventually Consistent Read in DynamoDB?
A Strongly Consistent Read in DynamoDB returns the most up-to-date data, while an Eventually Consistent Read may return stale data that has not yet been fully propagated to all replicas. Strongly Consistent Reads consume twice the read capacity units of Eventually Consistent Reads.
24. How can you enable encryption for data at rest in DynamoDB?
You can enable encryption for data at rest in DynamoDB by selecting an appropriate encryption option when you create a new table or by enabling encryption for an existing table. DynamoDB supports both server-side encryption with Amazon S3-managed keys and customer-managed keys.
25. How does DynamoDB handle schema changes?
DynamoDB is a schemaless database, which means that you can add or remove attributes from items without changing the underlying schema. If you need to modify the primary key or global secondary indexes, you must create a new table and migrate the data.
26. What is the difference between a Scan and a Query operation in DynamoDB?
A Scan operation reads all items in a table, while a Query operation reads items that match a specific partition key value or a range of values for the sort key. Query operations are generally faster and more efficient than Scan operations.
27. How does DynamoDB handle Auto Scaling?
DynamoDB Auto Scaling automatically adjusts the provisioned capacity of your table based on the actual usage of the table. You can configure Auto Scaling to scale up or down in response to changes in traffic or other usage patterns.
28. What is the maximum size of an item that can be stored in DynamoDB?
The maximum size of an item that can be stored in DynamoDB is 400 KB. If you need to store larger items, you can use the DynamoDB Streams feature to store the item in a separate storage system.
29. What is the difference between a Key Condition Expression and a Filter Expression in DynamoDB?
A Key Condition Expression is used to query items based on the partition key and sort key values, while a Filter Expression is used to further filter the results of a query or scan operation. Key Condition Expressions are evaluated before Filter Expressions, which can improve performance.
30. What is the difference between a BatchGetItem and a Query operation in DynamoDB?
A BatchGetItem operation retrieves up to 100 items from one or more tables using their primary keys, while a Query operation retrieves items that match a specific partition key value or a range of values for the sort key. BatchGetItem operations are generally faster and more efficient for retrieving a large number of items at once.