Skip to content

Commit 52b93bb

Browse files
committed
revamp ddb docs
1 parent 8e4ff82 commit 52b93bb

File tree

1 file changed

+25
-21
lines changed

1 file changed

+25
-21
lines changed

src/content/docs/aws/services/dynamodb.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
---
22
title: DynamoDB
3-
linkTitle: DynamoDB
43
description: Get started with DynamoDB on LocalStack
54
persistence: supported
65
tags: ["Free"]
@@ -11,7 +10,7 @@ It offers a flexible and highly scalable way to store and retrieve data, making
1110
DynamoDB provides a fast and scalable key-value datastore with support for replication, automatic scaling, data encryption at rest, and on-demand backup, among other capabilities.
1211

1312
LocalStack allows you to use the DynamoDB APIs in your local environment to manage key-value and document data models.
14-
The supported APIs are available on our [API coverage page]({{< ref "coverage_dynamodb" >}}), which provides information on the extent of DynamoDB's integration with LocalStack.
13+
The supported APIs are available on our [API coverage page](), which provides information on the extent of DynamoDB's integration with LocalStack.
1514

1615
DynamoDB emulation is powered by [DynamoDB Local](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html).
1716

@@ -27,14 +26,14 @@ We will demonstrate how to create DynamoDB table, along with its replicas, and p
2726
You can create a DynamoDB table using the [`CreateTable`](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_CreateTable.html) API.
2827
Execute the following command to create a table named `global01` with a primary key `id`:
2928

30-
{{< command >}}
31-
$ awslocal dynamodb create-table \
29+
```bash
30+
awslocal dynamodb create-table \
3231
--table-name global01 \
3332
--key-schema AttributeName=id,KeyType=HASH \
3433
--attribute-definitions AttributeName=id,AttributeType=S \
3534
--billing-mode PAY_PER_REQUEST \
3635
--region ap-south-1
37-
{{< /command >}}
36+
```
3837

3938
The following output would be retrieved:
4039

@@ -70,12 +69,12 @@ The following output would be retrieved:
7069
You can create replicas of a DynamoDB table using the [`UpdateTable`](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateTable.html) API.
7170
Execute the following command to create replicas in `ap-south-1` and `us-west-1` regions:
7271

73-
{{< command >}}
74-
$ awslocal dynamodb update-table \
72+
```bash
73+
awslocal dynamodb update-table \
7574
--table-name global01 \
7675
--replica-updates '[{"Create": {"RegionName": "eu-central-1"}}, {"Create": {"RegionName": "us-west-1"}}]' \
7776
--region ap-south-1
78-
{{< /command >}}
77+
```
7978

8079
The following output would be retrieved:
8180

@@ -107,10 +106,10 @@ You can now operate on the table in the replicated regions as well.
107106
You can use the [`ListTables`](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_ListTables.html) API to list the tables in the replicated regions.
108107
Run the following command to list the tables in the `eu-central-1` region:
109108

110-
{{< command >}}
111-
$ awslocal dynamodb list-tables \
109+
```bash
110+
awslocal dynamodb list-tables \
112111
--region eu-central-1
113-
{{< /command >}}
112+
```
114113

115114
The following output would be retrieved:
116115

@@ -127,34 +126,34 @@ The following output would be retrieved:
127126
You can insert an item into a DynamoDB table using the [`PutItem`](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_PutItem.html) API.
128127
Execute the following command to insert an item into the `global01` table:
129128

130-
{{< command >}}
131-
$ awslocal dynamodb put-item \
129+
```bash
130+
awslocal dynamodb put-item \
132131
--table-name global01 \
133132
--item '{"id":{"S":"foo"}}' \
134133
--region eu-central-1
135-
{{< /command >}}
134+
```
136135

137136
You can now query the number of items in the table using the [`DescribeTable`](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_DescribeTable.html) API.
138137
Run the following command to query the number of items in the `global01` table from a different region:
139138

140-
{{< command >}}
141-
$ awslocal dynamodb describe-table \
139+
```bash
140+
awslocal dynamodb describe-table \
142141
--table-name global01 \
143142
--query 'Table.ItemCount' \
144143
--region ap-south-1
145-
{{< /command >}}
144+
```
146145

147146
The following output would be retrieved:
148147

149148
```bash
150149
1
151150
```
152151

153-
{{< callout >}}
152+
:::note
154153
You can run DynamoDB in memory, which can greatly improve the performance of your database operations.
155154
However, this also means that the data will not be possible to persist on disk and will be lost even though persistence is enabled in LocalStack.
156155
To enable this feature, you need to set the environment variable `DYNAMODB_IN_MEMORY=1` while starting LocalStack.
157-
{{< /callout >}}
156+
:::
158157

159158
### Time To Live
160159

@@ -167,8 +166,13 @@ In addition, to programmatically trigger the worker at convenience, we provide t
167166

168167
The response returns the number of deleted items:
169168

170-
```console
169+
```bash
171170
curl -X DELETE localhost:4566/_aws/dynamodb/expired
171+
```
172+
173+
The output will be:
174+
175+
```json
172176
{"ExpiredItems": 3}
173177
```
174178

@@ -177,7 +181,7 @@ curl -X DELETE localhost:4566/_aws/dynamodb/expired
177181
The LocalStack Web Application provides a Resource Browser for managing DynamoDB tables and items.
178182
You can access the Resource Browser by opening the LocalStack Web Application in your browser, navigating to the **Resources** section, and then clicking on **DynamoDB** under the **Database** section.
179183

180-
<img src="dynamodb-resource-browser.png" alt="DynamoDB Resource Browser" title="DynamoDB Resource Browser" width="900" />
184+
![DynamoDB Resource Browser](/images/aws/dynamodb-resource-browser.png)
181185

182186
The Resource Browser allows you to perform the following actions:
183187

0 commit comments

Comments
 (0)