Amazon DynamoDB Introduction
In SSD (Solid State Drive, solid state drive), DynamoDB data is stored so that data of any size can be stored and accessed within the expected low-latency response time. Moreover, SSD also has high I/O efficiency and can handle the workload of large-scale requests. Let’s take a look at DynamoDB’s inappropriate use scenarios: If you need to store a large amount of data, but the frequency of access to this data is very low, DynamoDB may not be acceptable.
The DynamoDb data model is model-less and can be called a simple model of key-value. But the unique feature is that a single-attribute hash key or a compound hash-range key can be its primary key. For instance, “UserID” can be a single-attribute hash primary key, allowing you to read and write data quickly for things associated with a particular user ID.
A hash key element and a range key element are indexed as the compound hash-range key. The hierarchy between the first element value and the second element value is preserved by this multipart key. A composite hash-range key, for example, may be a mixture of “UserID” (hash) and “timestamp” (range). By holding the hash key element constant, you can check to retrieve items within the range key element. In this way, you can use the Query API to retrieve in a series of timestamps all objects of a single UserID, etc. This is why DynamoDB is somewhat close to SQL, as NoSQL is. At the same time, it will accomplish the benefits of both SQL and NoSQL, depending on you. Your database configuration.
SimpleDB has now been superseded by DynamoDB. If you know about SimpleDB, the comparison of the two can be seen below:
1. Since Amazon SimpleDB automatically indexes all item attributes, versatile queries, such as SQL, are supported, but performance and scalability will be affected.
2. SImpleDB limits the table size to 10G, while DynamoDB limits the total project size (including attribute names and attribute values) to no more than 64KB, but does not restrict the table size.
3. There are three scalar data types supported by Amazon DynamoDB: number, string, and binary. SimpleDB supports strings only.
4. NULL or empty strings are not provided by DynamoDB attribute values.
Dynamodb local version download and installation
#!/bin/bash# usage: curl https://s3-eu-west-1.amazonaws.com/ruanbekker.repo/scripts/bootstrap-dynamodb-local.sh | sudo bash# setup dependencies
yum update -y
yum install java-1.7.0-openjdk -y
yum install python-setuptools -y
easy_install pip
pip install boto
pip install awscli# create directory
mkdir -p /opt/ddb_local
cd /opt/ddb_local# download and extract
wget http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz
tar -xvf dynamodb_local_latest.tar.gz# run in background
nohup java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar - inMemory -sharedDb &
Install aws-cli
https://docs.aws.amazon.com/zh_cn/cli/latest/userguide/cli-chap-install.htmlpip install awscli — upgrade — userRun aws — version to verify that the AWS CLI is installed correctly.Local basic queryView the local tableaws dynamodb list-tables — endpoint-url http://localhost:8000Key queryaws dynamodb query — table-name message-push-record — key-condition-expression’messageId = :idvalue’ — expression-attribute-values’{“:idvalue”:{“S”:”111"}} ‘Remote aws dynamodb queryaws configureConfigure PS SK, areaThen execute the query:aws dynamodb list-tables
I like to learn new and better ways of doing things when working on a scale, and feel free to ask questions and make suggestions.
Also, check out another story on this.
Thanks for reading this.