[AWS Cloud Fundamental Notes] DynamoDB
Introduction to DynamoDB and its usage and operational mechanism
Distributed NoSQL database service.
Data access must be obtained through the corresponding Role (EC2) or using Credentials (developer) with IAM.
Terminology
Table
The basic unit for managing data, representing a collection of data.
Item
Each piece of data stored in a Table, internally structured as Key-Attributes, where each Attribute may have multiple Values.
Partition Key
Used to partition data, affecting the mechanism for placing data in a distributed database.
For example, if a class is set as the Partition Key, people in the same class will be placed in the same partition.
Sort Key
After entering the same Partition, data is sorted based on the Sort Key.
For example, if the Partition is a class, setting the Sort Key to height will sort the data by height.
Secondary Indexes
If the original Partition Key or Sort Key configuration is not satisfactory, a secondary index can be used to reset/add.
Local Secondary Index (LSI)
A local secondary index
is an index with the same partition key as the base table but a different sort key.
Each partition in the base table is included in the range of the local secondary index, the partition key values are the same.
The Partition Key remains the same, only the data inside the Partition is adjusted.
Adjust according to the new Sort Key.
Must be created together when the Table is created, cannot be appended or modified later.
For example, adjusting the Sort Key to birth month.
Global Secondary Index (GSI)
A global secondary index
is an index with a partition key and a sort key that can be different from those on the base table.
It is stored in its own partition space separate from the base table and is adjusted independently of the base table.
Partition Key and Sort Key can be changed together.
For example, changing the Partition Key to city of residence and selecting student ID as the Sort Key.
Billing
DynamoDB charges based on the volume of data transmitted for read and write requests.
Backup Solutions
- On-Demand Backup and Restore: On-Demand Backup and Restore
- Point-in-time Recovery: Point-in-time Recovery
On-Demand Backup and Restore | Point-in-time Recovery | |
---|---|---|
Backup Time | User-defined | AWS automatic backup |
Restore | Restore to a user-defined time point | Within the last 35 days |