concept dynamodb table in category node

appears as: DynamoDB table, DynamoDB tables, DynamoDB table
Serverless Applications with Node.js

This is an excerpt from Manning's book Serverless Applications with Node.js.

Listing 3.1 Create a DynamoDB table using the AWS CLI
aws dynamodb create-table --table-name pizza-orders \    #1  
  --attribute-definitions AttributeName=orderId,AttributeType=S \    #2  
  --key-schema AttributeName=orderId,KeyType=HASH \    #3  
  --provisioned-throughput ReadCapacityUnits=1,WriteCapacityUnits=1 \    #4  
  --region eu-central-1 \    #5  
  --query TableDescription.TableArn --output text    #6  

  #1   Create a pizza-orders table using the AWS CLI.
  #2   Provide an attribute definition and tell DynamoDB that your primary key is of type string (S).
  #3   Provide a key schema.
  #4   Set the throughput (read and write capacity) for the DynamoDB table.
  #5   Select the region for your DynamoDB table.
  #6   Print back the table’s Amazon Resource Name (ARN) to confirm that everything is set up correctly.
  • You can use DynamoDB in Node.js by installing the aws-sdk Node module. Among other things, the AWS SDK also exposes the DynamoDB DocumentClient class, which allows you to save, query, edit, and delete items in DynamoDB tables.
  • DynamoDB tables are similar to collections in traditional NoSQL databases. Unfortunately, they only allow queries by primary key, which can be a combination of hash and range keys.