So now let's talk about a database
that will appear quite a lot at the exam
from an architectural point of view,
which is Amazon DynamoDB.
So it's a fully managed database, it's highly available,
and it has replication of data across multiple AZs.
DynamoDB is special because it is Cloud native,
it's made by AWS's proprietary and it's a NoSQL database.
So it's not a relational database like RDS and Aurora
although it has still transaction supports.
So with DynamoDB, the use case is that
you can scale to massive workloads
because the database is internally distributed.
That means you can scale
to millions of requests per seconds,
trillions of rows and hundreds of terabytes of storage.
The idea is that, and you need to remember this,
you have single digit millisecond performance
which is going to be fast, of course, and consistent.
Also for all your security needs,
everything is integrated with IAM.
So for security, authorization, and administration,
it's low cost, has auto-scaling capabilities
that we'll see in a second,
and there is no maintenance or patching,
it's always available.
So you don't need to provision a database,
it's already there.
You just need to go ahead and create a table
and say how much capacity you want to put in this table.
You have two kind of table class,
you have the standard class for frequently accessed data
and you have the infrequent access,
the IA table class for infrequently accessed data.
So the basics of DynamoDB is that
DynamoDB is made of tables
but you don't need to create a database, okay?
It's not like Aurora and RDS,
the database is already there,
that is the service named DynamoDB.
So you go ahead and you create tables
and each table will have a primary key
and you decide on this at the creation time,
and then you add data.
So each table can have an infinite number of items
and there are rows and each item will have attributes.
And they're pretty much columns, but you can add
the attributes over time and they can be null.
So this is a big difference in an RDS or Aurora database,
you can add columns over time, but it's complicated process
and it can be difficult to evolve your schemas.
But then in DynamoDB, you can add attributes just like that
over time without any pre-requirements.
So the item size, the maximum item size in DynamoDB
is 400 kilobytes,
so DynamoDB is not there to store very large objects.
You have different data types supported,
you have the Scalar types such as String, Number, Binary,
Boolean, and Null, you have list, and maps, and sets.
So DynamoDB is at the exam,
gonna be a great choice if you need to see from
the exam that the schema,
so that means how your data looks, how it's shaped,
if the schema needs to rapidly evolve.
In that case, DynamoDB is a much better choice
than Aurora or RDS,
so look for this at the exam.
So here is an example of a table in DynamoDB.
We have a partition key,
optionally a sort key, which composes your primary key,
and then we have attributes
and then it looks just like a database, okay?
But it's possible, for example,
for your attributes to be null or to add attributes
over time, which makes the strength of DynamoDB.
Another thing you need to choose,
if you need to choose DynamoDB
is the capacity mode for reads and writes.
So you can control how to manage your table's capacity
and there are two modes you need to know about.
There is the provision mode, which is the default
in which you are going to provision the capacity in advance,
so you're going to say how many reads
and writes you expect per second
and that's going to be your capacity of your table,
so you need to plan the capacity beforehand
and then you're going to pay for every provision RCU or WCU
which stands for Read Capacity Units
or Write Capacity Units.
Although if you want a planned capacity,
you can still automatically adjust it
thanks to autoscaling,
which will increase or decrease your RCU and WCU
over time based on the load of your table.
So this is the provision mode and it works great
if your load is predictable, it evolves smoothly,
and you wanna do some cost saving
but there is also the On-Demand Mode.
And here, the read and writes capacity
will scale automatically with your workload.
There's no capacity planning needed,
there is actually no concept of RCU and WCU,
so instead in the On-Demand Mode
you're going to pay exactly for what you use,
so for every single writes
and every single reads you're going to pay for it.
So it's a lot more expensive as a solution
but it's going to be amazing for unpredictable workloads
or workloads that have steep, sudden spikes.
So again, these are some keywords you need to look
at for the exam,
if you have an application that will scale
from a thousand transactions
to 1 million transactions in less than a minute,
Provision Mode is not going to be good for you
because it doesn't scale fast enough.
So in that case, you need to use On-Demand Mode
or if you have a workload that has no transactions at all,
maybe four or five times a day maximum then
On-Demand Mode is great because you're only going to pay
for these four or five transactions.
So look out for the differences and these keywords
and you will be able to select
between Provision Mode and On-Demand Mode.
So that's it for the DynamoDB basics,
I hope you liked it and I will see you in the next lecture.