![local dynamodb ui local dynamodb ui](https://miro.medium.com/max/2880/1*tE_m0t2IHGlFbJGxTCdFHA.png)
We define a repository class to define the CRUD methods using the mapping object created in the previous step. The mapping is defined by putting annotations on the fields of the data class to specify the keys and attributes. and then define the mapping of this data class with table residing in the database. We define a data class for our domain objects like customer, product, order, etc.
![local dynamodb ui local dynamodb ui](https://hackers-high.com/images/dynamodb-admin-screenshot.png)
DynamoDB uses this value as input to its hash function, to locate the partition in which the item can be found. When we read an item from the table, we must specify the partition key value for the item. The output of the hash function determines the partition in which the item will be stored. When we write an item to the table, DynamoDB uses the value of the partition key as input to an internal hash function. In our example above, each order is uniquely identified by a composite primary key with customerID as the partition key and orderID as the sort key.Ī partition is a unit of storage for a table where the data is stored by DynamoDB. 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 ui local dynamodb ui](https://res.cloudinary.com/practicaldev/image/fetch/s--GfFjaki4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5wcif2yu14fyc813qkcs.png)
Local dynamodb ui code#
This article is accompanied by a working code example on GitHub.Īmazon DynamoDB is a key-value database.
Local dynamodb ui 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 This article gives only a first impression of what you can do with AWS.