DynamoDB Interview Questions and Answers (2024) | TechGeekNext


DynamoDB Interview Questions and Answers (2024)

In this post, questions from Dynamodb Interviews will be answered for Experienced and Freshers. We're trying to share our experience and learn how to help you make progress in your career.

AWS DynamoDB Tutorial :

  1. AWS DynamoDB Setup
  2. Spring Boot + DynamoDB Crud Example
  3. AWS DynamoDB Interview Questions and Answers
  1. What is DynamoDB?
  2. Is DynamoDB a SQL?
  3. Is DynamoDB free for use?
  4. What are advantages of DynamoDB?
  5. How to generate DynamoDB Access Key and Secret Key?
  6. What is DynamoDBMapper class?
  7. List methods of DynamoDBMapper class?
  8. Is DynamoDBMapper thread safe?
  9. Does Amazon DynamoDB support both increment and decrement atomic operations?
  10. Does DynamoDB support in place atomic updates?
  11. Are DynamoDB writes Atomic?
  12. What kind of query functionality does DynamoDB support?
  13. What is difference between MongoDB and DynamoDB?
  14. Is Redis faster than DynamoDB?

Q: What is DynamoDB?
Ans:

  1. Amazon DynamoDB is a fully managed proprietary NoSQL database service that provides fast and predictable performance with seamless scalability.
  2. It supports key-value and document data structures
  3. DynamoDB allows users to create tables for your database to store and retrieve any data volume and to support any request traffic level.

Q: Is DynamoDB a SQL?
Ans:

DynamoDB is NoSQL database, it can handle structured or semi structured data, including JSON documents. DynamoDB scales to accommodate very large amounts of data and very large number of users seamlessly.
SQL is the standard for storing and retrieving data. Relational databases have a wide range of tools available for simplifying the development of database-driven applications, however all of these tools uses SQL.

Q: Is DynamoDB free for use?
Ans:

Amazon DynamoDB is a fully managed NoSQL licensed database.
You can start with free tier limits of DynamoDB on which many applications runs.
If services are required, the price per month varies depending on the type of resources you need.

Q: What are advantages of DynamoDB?
Ans:

  1. Scalable - Unlimited amounts of data can be stored.
  2. Distributed - DynamoDB scales horizontally by expanding a single table over multiple server.
  3. Cost Effective - One year free tier provides more than 40 million database operations/month and pricing is based on throughput (read/write per second) than just storage.
  4. Easy Administration - Fully managed service from Amazon.
  5. Automatic data replication - All data items are stored on Solid State Disks (SSDs) and automatically replicated across multiple availability zones in a region.
  6. Secure - DynamoDB security is better and is usually supported by the security measure provided by AWS. In order to authenticate users and prevent unauthorised data access, it uses proven secure techniques.

Q: How to generate DynamoDB Access Key and Secret Key?
Ans:

By Creating User from AWS IAM (Identity Access Management), will be able to generate access key and secret key.
You can follow steps given from DynamoDB Setup to generate access key and secret key.

Q: What is DynamoDBMapper class?
Ans:

The entry point for DynamoDB is the DynamoDBMapper class. It provides access to a DynamoDB endpoint and allows you to access your data from different tables, perform various CRUD operations, and execute queries and scans table.

Refer Spring Boot + DynamoDB Example to understand DynamoDBMapper.

Q: List methods of DynamoDBMapper class.
Ans:

Below are the methods of DynamoDBMapper:

  1. save

    Saves the specified object to the table. The object that you want to save is the only required parameter for this method. You can provide optional configuration parameters using the DynamoDBMapperConfig object.

    mapper.save(obj, new DynamoDBMapperConfig(DynamoDBMapperConfig.SaveBehavior.CLOBBER));

  2. load

    Retrieves an item from a table. You must provide the primary key of the item that you want to retrieve. You can provide optional configuration parameters using the DynamoDBMapperConfig object.

    BookCatalog catalog = mapper.load(BookCatalog.class, catalog.getId(),
    new DynamoDBMapperConfig(DynamoDBMapperConfig.ConsistentReads.CONSISTENT));

  3. delete

    Deletes an item from the table. You must pass in an object instance of the mapped class.

  4. query

    Queries a table or a secondary index. You can query a table or an index only if it has a composite primary key (partition key and sort key).

  5. queryPage

    Scans an entire table or a secondary index. You can optionally specify a FilterExpression to filter the result set.

  6. scanPage

    Scans a table or secondary index and returns a single page of matching results. As with the scan method, you can optionally specify a FilterExpression to filter the result set. However, scanPage only returns the first "page" of data, that is, the amount of data that fits within 1 MB.

  7. parallelScan

    Performs a parallel scan of an entire table or secondary index. You specify a number of logical segments for the table, along with a scan expression to filter the results.

  8. batchSave

    Saves objects to one or more tables using one or more calls to the AmazonDynamoDB.batchWriteItem method. This method does not provide transaction guarantees.

  9. batchLoad

    Retrieves multiple items from one or more tables using their primary keys.

  10. batchDelete

    Deletes objects from one or more tables using one or more calls to the AmazonDynamoDB.batchWriteItem method. This method does not provide transaction guarantees.

  11. batchWrite

    Saves objects to and deletes objects from one or more tables using one or more calls to the AmazonDynamoDB.batchWriteItem method. This method does not provide transaction guarantees or support versioning (conditional puts or deletes).

  12. transactionWrite

    Saves objects to and deletes objects from one or more tables using one call to the AmazonDynamoDB.transactWriteItems method.

  13. transactionLoad

    Loads objects from one or more tables using one call to the AmazonDynamoDB.transactGetItems method.

  14. count

    Evaluates the specified scan expression and returns the count of matching items. No item data is returned.

  15. generateCreateTableRequest

    Parses a POJO class that represents a DynamoDB table, and returns a CreateTableRequest for that table.

  16. createS3Link

    Creates a link to an object in Amazon S3. You must specify a bucket name and a key name, which uniquely identifies the object in the bucket.

  17. getS3ClientCache

    Returns the underlying S3ClientCache for accessing Amazon S3. An S3ClientCache is a smart Map for AmazonS3Client objects. If you have multiple clients, an S3ClientCache can help you keep the clients organized by AWS Region, and can create new Amazon S3 clients on demand.


Q: Is DynamoDBMapper thread safe?
Ans:

This class is thread-safe and can be shared between threads. While using the save, load, and delete methods, DynamoDBMapper will throw DynamoDBMappingException to show that domain classes are incorrectly annotated or otherwise incompatible with this class.

Q: Does Amazon DynamoDB support both increment and decrement atomic operations?
Ans:

Yes,Amazon DynamoDB supports increment and decrement atomic operations.

Q: Does DynamoDB support in place atomic updates?
Ans:

Amazon DynamoDB supports fast in-place updates. You can increment or decrement a numeric attribute in a row using a single API call. Similarly, you can atomically add or remove to sets, lists, or maps.

Q: Are DynamoDB writes Atomic?
Ans:

DynamoDB allows atomic counters, in which it uses the update method to increment or decrement the value of an existing attribute without interfering with other write requests. Each time it runs the program, it increments this attribute by one.

Q: What kind of query functionality does DynamoDB support?
Ans:

It supports the operation of GET/PUT using the primary key specified by the user. Flexible querying is enabled by allowing a non-primary key attribute to be queried using local secondary indexes and global secondary indexes.

Q: What is difference between MongoDB and DynamoDB?
Ans:

MongoDB
DynamoDB

MongoDB is designed and developed by MongoDB Inc.

DynamoDB is designed and developed by Amazon.com.

MongoDB uses JSON-like documents.

DynamoDB uses tables, items and attributes.

MongoDB is difficult to configure and install it. That is because it does not have provide guidance to perform. In order to make it easier to use MongoDB, they have provided MongoDB Atlas which is a cloud hosted.

Setting up and installation of DynamoDB is very easy since it is a web service provided by Amazon.com.

MongoDB supports more data types and has fewer size restrictions.

DynamoDB supports limited data types and smaller item sizes.

MongoDB is not so secure, because by default it keeps authentication off while installing MongoDB.

DynamoDB security is better and is usually supported by the security measure provided by AWS.

Q: Is Redis faster than DynamoDB?
Ans:

Since DynamoDB is NoSQL, so Insert/Delete is so fast.(slower than Redis, but we don't need to that much speed) DynamoDB store data permanently.

Take a look at our suggested post on AWS :







Recommendation for Top Popular Post :