eolas/zk/DynamoDB CLI commands.md

43 lines
1,006 B
Markdown
Raw Normal View History

2024-06-22 11:00:04 +01:00
---
id: l045
title: DynamoDB CLI commands
tags: [AWS, databases, dynamodb]
created: Saturday, June 22, 2024
---
# DynamoDB CLI commands
## Connecting to a local (Docker) DynamoDB instance
In order to distinguish between local and production accounts you should keep
seperate configs in `.aws/config` and `.aws/credentials`. Then specify the
profile if you are working locally and the local URL. Without the `--profile`
flag, AWS will default to the `default` profile which will typically be your
credentials for accessing AWS on the remote.
```sh
aws dynamodb list-tables --profile timetracking_dev --endpoint-url
http://localhost:800
```
## Delete a table
```sh
2024-06-22 11:15:04 +01:00
aws dynamodb delete-table \
2024-06-22 12:45:05 +01:00
--profile timetracking_dev \
2024-06-22 11:15:04 +01:00
--endpoint-url http://localhost:8000 \
--table-name TableName
```
## Create table from JSON schema
```sh
aws dynamodb create-table \
--cli-input-json file://create-timeentries-table.json \
2024-06-22 12:45:05 +01:00
--profile timetracking_dev \
2024-06-22 11:15:04 +01:00
--endpoint-url http://localhost:8000
2024-06-22 11:00:04 +01:00
```
## Related notes