If we wanted to store a customer record, then we could have used customerID or email as a partition key to uniquely identify the customer in the DynamoDB table.Ĭomposite Primary Key: This is composed of two attributes - a partition key and a sort keys. Simple Primary Key: This is composed of one attribute called the Partition Key. The primary key is used to uniquely identify each item in an Amazon DynamoDB table. Uniquely Identifying Items in a Table with Primary Key In our example, each order item has OrderValue, OrderDate as scalar attributes and products list as a nested type attribute. Most of the attributes are scalar like strings and numbers while some are of nested types like lists, maps, or sets.
They are similar to columns in a relational database.Įach item has its own attributes. An item is composed of attributes, which are different elements of data for a particular item. Each order is uniquely identified by a combination of customerID and orderID.Ī table contains one or more items. This diagram shows the organization of order records placed by a customer in a Order table. Other than the primary key, we do not need to define any additional attributes when creating a table. Like in many databases, a table is the fundamental concept in DynamoDB where we store our data. Here we will only skim through the main concepts that are essential for designing our applications. There is plenty to know about DynamoDB for building a good understanding for which we should refer to the official documentation. Both the keys and the values can be simple or complex objects. A key-value database stores data as a collection of key-value pairs.
#Local dynamodb unable to create table code#
This article is accompanied by a working code example on GitHub.Īmazon DynamoDB is a key-value database.
#Local dynamodb unable to create table how to#
If you want to go deeper and learn how to deploy a Spring Boot application to the AWS cloud and how to connect it to cloud services like RDS, Cognito, and SQS, make sure to check out the book Stratospheric - From Zero to Production with Spring Boot and AWS! Example Code
Originally posted on my blog.This article gives only a first impression of what you can do with AWS. This first post on the topic is short and simple, but you can take parts of it and elaborate ie set global commands to run DynamoDB from anywhere. To recap today's short post, we set up a simple way to run DynamoDB locally from a simple project and then explored the NoSQL Workbench and did a basic GetItem request to show how we can connect up our local DynamoDB. Selecting it will return the values for that particular item:Īs an added bonus, if you select Generate code, NoSQL Workbench will even generate some code in Python, JavaScript and Java for you to use or take inspiration from.įrom here, we can plan out our tables and run CRUD operations to test these from within the NoSQL Workbench and our local DynamoDB instance! If you select Expand operation, select GetItem from the data plane operations dropdown and Forum from the table dropdown, we can then pop a value such as Amazon MQ into the required Partition key value. Now we can open up the connection in the operation builder and select the Forum table.Įxploring the data in the table gives us an idea of some basic queries we can make. Finally, select Commit to Amazon DynamoDB and from the Saved connections you can now select you localhost instance to commit the tables. From here, select Visualize data model to open the Visualizer. Now we can run a simple GetItem on Amazon DynamoDB for the Forum table.įirst, head back to the Amazon DynamoDB tab, hover over the AWS Discussion Forum Data Model and open it. Once there, select Add connection, choose the DynamoDB local tab and ensure that the details there are correct to your localhost port and add the connection.
In order to run queries against the local, select the Operation builder on the left-hand side panel. Enter fullscreen mode Exit fullscreen mode