HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

aws dynamodb — Manipulate an AWS Dynamodb database, a fast NoSQL database with predictable performance and seamless

Submitted by: @import:tldr-pages··
0
Viewed 0 times
dynamodbcommandaws dynamodbdatabasemanipulateclifastaws

Problem

How to use the aws dynamodb command: Manipulate an AWS Dynamodb database, a fast NoSQL database with predictable performance and seamless scalability. More information: <https://docs.aws.amazon.com/cli/latest/reference/dynamodb/>.

Solution

aws dynamodb — Manipulate an AWS Dynamodb database, a fast NoSQL database with predictable performance and seamless scalability. More information: <https://docs.aws.amazon.com/cli/latest/reference/dynamodb/>.

Create a table:
aws dynamodb create-table --table-name {{table_name}} --attribute-definitions {{AttributeName=S,AttributeType=S}} --key-schema {{AttributeName=S,KeyType=HASH}} --provisioned-throughput {{ReadCapacityUnits=5,WriteCapacityUnits=5}}


List all tables in the DynamoDB:
aws dynamodb list-tables


Get details about a specific table:
aws dynamodb describe-table --table-name {{table_name}}


Add an item to a table:
aws dynamodb put-item --table-name {{table_name}} --item '{{{"AttributeName": {"S": "value"}}}}'


Retrieve an item from a table:
aws dynamodb get-item --table-name {{table_name}} --key '{{{"ID": {"N": "1"}}}}'


Update an item in the table:
aws dynamodb update-item --table-name {{table_name}} --key '{{{"ID": {"N": "1"}}}}' --update-expression "{{SET Name = :n}}" --expression-attribute-values '{{{":n": {"S": "Jane"}}}}'


Scan items in the table:
aws dynamodb scan --table-name {{table_name}}


Delete an item from the table:
aws dynamodb delete-item --table-name {{table_name}} --key '{{{"ID": {"N": "1"}}}}'

Code Snippets

Create a table

aws dynamodb create-table --table-name {{table_name}} --attribute-definitions {{AttributeName=S,AttributeType=S}} --key-schema {{AttributeName=S,KeyType=HASH}} --provisioned-throughput {{ReadCapacityUnits=5,WriteCapacityUnits=5}}

List all tables in the DynamoDB

aws dynamodb list-tables

Get details about a specific table

aws dynamodb describe-table --table-name {{table_name}}

Add an item to a table

aws dynamodb put-item --table-name {{table_name}} --item '{{{"AttributeName": {"S": "value"}}}}'

Retrieve an item from a table

aws dynamodb get-item --table-name {{table_name}} --key '{{{"ID": {"N": "1"}}}}'

Context

tldr-pages: common/aws dynamodb

Revisions (0)

No revisions yet.