What we will learns in this article:
· DynamoDB and it’s features
· How to create a simple table, add data, scan and query the data, delete data, and delete the table.
What is DynamoDB?
DynamoDB is a fully managed NoSQL serverless database offered by AWS. DynamoDB is a great fit for mobile, web, gaming, ad tech, and IoT applications where scalability, throughput, and reliable performance are key considerations.
Features of DynamoDB:
NoSQL database:
Managed and Serverless: It has a flexible schema which allows you to have many different attributes for one item. We can easily adapt business requirement change without having to refine the table schema. It also supports key-value and document data models.
Managed and Scalable service:
As it is a managed service, you don’t need to worry about the provisioning, managing, maintaining and operating the underlying servers. It is pay-as-go service which scales to zero and automatically scales tables to adjust the capacity to match your workload for you.
DynamoDB Global Table:
With Global tables you can read and writes can access data locally in the selected Regions to get single-digit millisecond read and write performance. global tables automatically scale capacity to accommodate your multi-Region workloads which improves your applications multi-region resiliency.
DynamoDB Streams:
It captures data modification events i.e. create, update, or delete items in a table near real time. Each record has a unique sequence number which is used for ordering
Secondary Indexes:
DynamoDB provides fast access to items in a table by specifying primary key values. However, many applications might benefit from having one or more secondary (or alternate) keys available, to allow efficient access to data with attributes other than the primary key. DynamoDB provides 2 kinds of Indexes: Global Secondary Index and Local Secondary Index.
DynamoDB Accelerator (DAX):
Built-in caching service for DynamoDB which is fully managed and highly available. It can serve millions of requests per second with micro-seconds response time for read-heavy workload.
On-Demand Capacity Mode:
Allows user to scale seamlessly without capacity planning. It ensures optimal performance and cost efficiency for fluctuating workloads.
Point-in-time Recovery:
Enables users to restore their data to any second within a 35 days of retention period, protecting against accidental data loss. It provides peace of mind by allowing effortless recovery from user errors or malicious actions, ensuring data integrity and availability.
Encryption at Rest:
By default, DynamoDB encrypts all data at rest using AWS KMS (Key Management Service), providing an additional layer of protection against unauthorized access.
Built-in support for ACID transactions:
DynamoDB guarantees ACID (Atomicity, Consistency, Isolation, Durability) properties for transactions, ensuring reliable and predictable data operations. Amazon DynamoDB provides native, server-side transcations, simplifying the developer experience of making coordinated, all-or-nothing changes to multiple items both within and across tables.
Login into your AWS Management Console account and search for DynamoDB
Creating a NoSQL table:
Click on Create Table
Give the table name (AWS Learners), partition key (LearnerName) and sort key (Certifications)
For table Settings, select Customize settings (To enable auto-scaling for our table). DynamoDB auto scaling will change the read and write capacity of your table based on request volume. Rest of the settings should be remained as it is, just add the json policy.
Add data to the NoSQL table
Click on Create Item
Enter the value for LearnerName and Certification
Query the NoSQL Data
Search for data in the table using query operations. In DynamoDB, query operations are efficient and use keys to find data.
Deleting an existing item
Here I am deleting the item named Jay
Delete a NoSQL Table:
Deleting the entire AWSLearner table.
Type confirm to delete entire table
So, we created our first DynamoDB table, added items to the table, and then queried the table to find the items we wanted. Also, learned how to visually manage your DynamoDB tables and items through the AWS Management Console.
Special shoutout to AWS for curating an exceptional step-by-step tutorial on creating, querying, and deleting a DynamoDB table. This resource provided invaluable insights and hands-on experience with AWS DynamoDB, empowering us to harness its capabilities effectively. I also extend a special thank you to Greg Powell https://www.linkedin.com/in/thoughtfultechy/ for sharing this AWS Labs tutorial on his LinkedIn post. His contribution facilitated our learning journey and enabled us to gain practical experience in utilizing AWS DynamoDB services.
Resources used for this article: