Autosave: 2024-06-23 12:45:04
This commit is contained in:
parent
c0876f7562
commit
b96aa58485
2 changed files with 34 additions and 0 deletions
BIN
.zk/notebook.db
BIN
.zk/notebook.db
Binary file not shown.
34
zk/DynamoDB SDK commands.md
Normal file
34
zk/DynamoDB SDK commands.md
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
---
|
||||||
|
id: 8b6h
|
||||||
|
title: DynamoDB SDK commands
|
||||||
|
tags: [AWS, databases, dynamodb]
|
||||||
|
created: Sunday, June 23, 2024
|
||||||
|
---
|
||||||
|
|
||||||
|
# DynamoDB SDK commands
|
||||||
|
|
||||||
|
The following commands are for using `@aws-sdk/client-dynamodb` (the JS SDK).
|
||||||
|
|
||||||
|
## Create client
|
||||||
|
|
||||||
|
```js
|
||||||
|
import DynamoDBClient from "@aws-sdk/client-dynamodb";
|
||||||
|
|
||||||
|
const client = new DynamoDBClient({
|
||||||
|
region: "eu-west-2",
|
||||||
|
accessKeyId: process.env.ACCESS_KEY_ID,
|
||||||
|
secretAccessKey: process.env.ACCESS_KEY_ID,
|
||||||
|
});
|
||||||
|
```
|
||||||
|
|
||||||
|
## Query a table
|
||||||
|
|
||||||
|
Querying is the most performant and cost-effective method since it is an O(1)
|
||||||
|
lookup against a partition key or secondary index.
|
||||||
|
|
||||||
|
## Scan a table
|
||||||
|
|
||||||
|
Scanning is less performant (O(n)) and most expensive since it requires checking
|
||||||
|
every item in the database.
|
||||||
|
|
||||||
|
## Related notes
|
Loading…
Add table
Reference in a new issue