In this video, we are going to create our first Amazon Dynamic DB table with using a measurement console.
You can see the image on the slide.
We are at the beginning of our use cases.
The first use case is create a table so we will implement a create table command with using ADD this
measurement console to the Dynamo DB.
So let's get started.
To do that, please open a management console and search for the Dynamo DB.
And you can put a star in here in order to add to favorites Dynamo DB and collected Dynamo DB page.
So this is the default page of IMDB.
Since we have no any tables, we see the default page.
If we have some tables on this list, we will see the table list in our application.
So if you scroll down, this is the general welcome page, which includes good resource and links,
links about the documentation and resources we can see in here, use cases, links and so on.
So basically in this video, we are going to create a table, dynamic table and see the core concepts
over the dynamic DB table.
So in this step, we should design our table and table attributes.
That means before we are creating a table.
It is good, good practice to designing our table and table attributes before creating a table.
For that purpose, I have created this notepad design documentation.
You can see that we are going to create an order table and these are the attributes that means ID status
details and order date.
So I put an ID as a partition key and status as a sort.
I will explain later, but that means we will design our table and attributes that is ready for the
creating table on a management console.
So please click the create table button and we will start creating our dining table.
So after I come to create Table Page, you can see the table details in here.
So we will configure our table with details.
So we see the table, the taste box and dynamic DB is seamless database that require only a table name
and the primary key when you create a table.
So we don't need to and we don't have to specify attributes when designing our table.
We can add the attributes when inserting table items into dynamic DB because dynamic DB is no skill
and schemas database.
So the first parameter is table name that we have already create our design and copy table name.
In here we are creating an order table.
So the second configuration is one of the important configuration, which is the partition key.
The partition key is a part of the table's primary key.
It's a hash value that is used to retrieve items from our table and allocate data across for scalability
and availability.
So we have set the partition key as a ID and I'm going to set the string.
We can see that we have three options eating number and binary and most, if you will, use string data
types.
And so parsing key is so important configuration because we can change this later.
This should only set when creating a table is the same way we have a sort k sort k also can change after
created table.
We can add sort k after created the table.
So if you come to sort key, we can use a sort key as a second part of our tables.
Primary key, the sort key allows you to sort or search among all items sharing the same partition.
K Again, we can select the string volume in here and at this point of time would be table.
Then we should make an important decision because these keys cannot be changed after table is created.
So since the third key sort k is optional.
How we can decide that if we need to put sort K or not in our dynamic db table.
So we should think about our items into the table.
Let me open our design window.
So let's think now if all the table will have one more item with the same order ID, we can think that
we can put sort key like status in order to run queries.
So let me explain better.
So think about that.
We are loading the table items in here.
I'm going to add item into table.
Let me see that order ID equal one.
And statues equal penny.
So again, order ID a cool one.
So that means ID is a partisan k, but we have one more record, one more item into our dynamic DB table
with the same same parts in K and status could be completed.
So if you have this kind of use case, that means same parts in K for two items.
If this is the case, yes, it is good to use sort k.
But.
But it is not true.
That means your parts in case should be always unique.
So you don't need to put any sort k into your application.
If a record of our order ID is unique for all items, that means that we don't need to use sort K in
our table.
So in our case now it is good to sort k.
So let me create a sort key also because I would like to show you both scan and create operations on
this table.
So I'm going to add a sort K which is the status.
And after that we can scroll down and we can see there are two settings types and there is a table settings.
One is the default settings and another is customized settings.
The default one is configured by a yes.
You can choose the default one if you don't want to configure some advanced settings, but the customized
one is that allow us to configure all items by ourselves.
So default setting is the fastest way to create our table.
We can modify these settings now or after table is created and usually we can pick the default settings.
But let's all with all configuration with selecting the customize settings, select the customize settings.
And if you scroll down, the first configuration is table class and we can select table class to optimize
our tables, cost base or workload requirements and data access patterns.
I'm going to select a standard way and if you scroll down, another important configuration is read,
write capacity settings.
You can see in here as you remember that we have to estimate which is the on demand and provision on
demand is basically billing by paying for the actual reads and rights of our application, we can think
that is the pay as you go model.
So another one is the provision we can manage and optimize our cost by allocating read write capacity
in advance.
So when it comes to use with server services, we should pick the on demand service.
I'm going to select the on demand and it is good fit to our serverless applications.
We can also scroll down and see the secondary index conditions.
You can see the secondary index.
We have local secondary index and global secondary index.
Local index similar with the sort Keith is note that we can't add sort key after the table creation,
but we can add the local index in order to provide query in the selected region.
And we have also a global secondary index, GSI, we can add this after table creation.
This is adding index globally and effect to cost for our table.
This is not free, so please don't create a global secondary index for our project.
So I'm going to leave default settings in here.
Another configuration is encryption.
You can see in here that I am not going to change and leave as the default one and go to scroll on at
the bottom of the page and click the create table button.
Often this kind of takes a couple of minutes to create the A.V. Table It's going to provision the database
somewhere in the region.
So check this out.
With refreshing this table, you can see that it's sort of creating if it refresh, we can see that
this is the active now.
So refresh since we can see active status.
And if you click the table and go to summary page, you can see that this is the table main page that
we can see all the days, see general information section, see the primary K and sort K, you can see
in here so and see all other features and configurations in this window.
If you go to the indexes, you can see the all global secondary index and local secondary index.
In this section we can also see the monitor like lambda function.
We can monitor, read and write usage and we taste in this section.
So as you can see that we have successfully create table in Amazon dynamic DB with using a measurement
console.