Inserting and accessing data in DynamoDB
Now that we've covered the history and theory of DynamoDB, it's time to put our hands on our keyboards and actually get into the data.
For our example, we will create a fictional database to keep track of the projects at our company. This can include information such as ProjectID
, the name of the project, who the project owner is, what the contact email is for the project or the team, and even other information such as build and language information. Since DynamoDB has a flexible schema, not all this information is needed in all the rows. We do, however, need to declare our primary key and then, depending on what we query, our secondary key.
Our schema will look like the following JSON
:
{ Project_ID, Department, Owner, < optional information (like language or build id) >, Contact_Email }
With our schema defined, we can start creating our table.
Creating tables in Dynamo DB
We can now open up our terminal...