Skip to content

Commit

Permalink
Bash: DynamoDB MVP (#5363)
Browse files Browse the repository at this point in the history
  • Loading branch information
meyertst-aws authored Sep 15, 2023
1 parent f7dddc1 commit af86eb9
Show file tree
Hide file tree
Showing 14 changed files with 5,875 additions and 1 deletion.
175 changes: 175 additions & 0 deletions .doc_gen/metadata/dynamodb_metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,19 @@ dynamodb_CreateTable:
- description:
snippet_tags:
- ddb.swift.basics.createtable
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description:
snippet_tags:
- aws-cli.bash-linux.dynamodb.CreateTable
- description: The utility functions used in this example.
snippet_tags:
- aws-cli.bash-linux.dynamodb.iecho
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb: {CreateTable}
dynamodb_BatchGetItem:
Expand Down Expand Up @@ -205,6 +218,18 @@ dynamodb_BatchGetItem:
- description:
snippet_tags:
- ddb.swift.batchgetitem.batchget
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description:
snippet_tags:
- aws-cli.bash-linux.dynamodb.BatchGetItem
- description: The utility functions used in this example.
snippet_tags:
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb: {BatchGetItem}
dynamodb_DescribeTable:
Expand Down Expand Up @@ -282,6 +307,18 @@ dynamodb_DescribeTable:
snippet_tags:
- ruby.example_code.dynamodb.Scaffold
- ruby.example_code.dynamodb.DescribeTable
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description:
snippet_tags:
- aws-cli.bash-linux.dynamodb.DescribeTable
- description: The utility functions used in this example.
snippet_tags:
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb: {DescribeTable}
dynamodb_BatchWriteItem:
Expand Down Expand Up @@ -376,6 +413,19 @@ dynamodb_BatchWriteItem:
- description:
snippet_tags:
- ddb.swift.basics.populate
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description:
snippet_tags:
- aws-cli.bash-linux.dynamodb.BatchWriteItem
- description: The utility functions used in this example.
snippet_tags:
- aws-cli.bash-linux.dynamodb.iecho
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb: {BatchWriteItem}
dynamodb_DeleteTable:
Expand Down Expand Up @@ -486,6 +536,19 @@ dynamodb_DeleteTable:
- description:
snippet_tags:
- ddb.swift.basics.deletetable
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description:
snippet_tags:
- aws-cli.bash-linux.dynamodb.DeleteTable
- description: The utility functions used in this example.
snippet_tags:
- aws-cli.bash-linux.dynamodb.iecho
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb: {DeleteTable}
dynamodb_PutItem:
Expand Down Expand Up @@ -602,6 +665,19 @@ dynamodb_PutItem:
snippet_tags:
- ddb.swift.basics.add-movie
- ddb.swift.basics.movie.getasitem
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description:
snippet_tags:
- aws-cli.bash-linux.dynamodb.PutItem
- description: The utility functions used in this example.
snippet_tags:
- aws-cli.bash-linux.dynamodb.iecho
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb: {PutItem}
dynamodb_GetItem:
Expand Down Expand Up @@ -709,6 +785,18 @@ dynamodb_GetItem:
- description:
snippet_tags:
- ddb.swift.basics.get
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description:
snippet_tags:
- aws-cli.bash-linux.dynamodb.GetItem
- description: The utility functions used in this example.
snippet_tags:
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb: {GetItem}
dynamodb_UpdateItem:
Expand Down Expand Up @@ -816,6 +904,19 @@ dynamodb_UpdateItem:
- description:
snippet_tags:
- ddb.swift.basics.update
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description:
snippet_tags:
- aws-cli.bash-linux.dynamodb.UpdateItem
- description: The utility functions used in this example.
snippet_tags:
- aws-cli.bash-linux.dynamodb.iecho
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb: {UpdateItem}
dynamodb_DeleteItem:
Expand Down Expand Up @@ -939,6 +1040,19 @@ dynamodb_DeleteItem:
- description:
snippet_tags:
- ddb.swift.basics.delete
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description:
snippet_tags:
- aws-cli.bash-linux.dynamodb.DeleteItem
- description: The utility functions used in this example.
snippet_tags:
- aws-cli.bash-linux.dynamodb.iecho
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb: {DeleteItem}
dynamodb_ListTables:
Expand Down Expand Up @@ -1054,6 +1168,18 @@ dynamodb_ListTables:
- description:
snippet_tags:
- ddb.swift.databasemanager.gettablelist
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description:
snippet_tags:
- aws-cli.bash-linux.dynamodb.ListTables
- description: The utility functions used in this example.
snippet_tags:
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb: {ListTables}
dynamodb_Query:
Expand Down Expand Up @@ -1174,6 +1300,18 @@ dynamodb_Query:
- description:
snippet_tags:
- ddb.swift.basics.getMovies-year
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description:
snippet_tags:
- aws-cli.bash-linux.dynamodb.Query
- description: The utility functions used in this example.
snippet_tags:
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb: {Query}
dynamodb_Scan:
Expand Down Expand Up @@ -1286,6 +1424,18 @@ dynamodb_Scan:
- description:
snippet_tags:
- ddb.swift.basics.getmovies-range
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description:
snippet_tags:
- aws-cli.bash-linux.dynamodb.Scan
- description: The utility functions used in this example.
snippet_tags:
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb: {Scan}
dynamodb_ExecuteStatement:
Expand Down Expand Up @@ -1748,6 +1898,31 @@ dynamodb_Scenario_GettingStartedMovies:
a &DDB; database.
snippet_tags:
- ddb.swift.basics
Bash:
versions:
- sdk_version: 2
github: aws-cli/bash-linux/dynamodb
excerpts:
- description: The &DDB; getting started scenario.
snippet_tags:
- aws-cli.bash-linux.dynamodb.scenario_getting_started_movies
- description: The &DDB; functions used in this scenario.
snippet_tags:
- aws-cli.bash-linux.dynamodb.CreateTable
- aws-cli.bash-linux.dynamodb.DescribeTable
- aws-cli.bash-linux.dynamodb.PutItem
- aws-cli.bash-linux.dynamodb.UpdateItem
- aws-cli.bash-linux.dynamodb.BatchWriteItem
- aws-cli.bash-linux.dynamodb.GetItem
- aws-cli.bash-linux.dynamodb.Query
- aws-cli.bash-linux.dynamodb.Scan
- aws-cli.bash-linux.dynamodb.DeleteItem
- aws-cli.bash-linux.dynamodb.DeleteTable
- description: The utility functions used in this scenario.
snippet_tags:
- aws-cli.bash-linux.dynamodb.iecho
- aws-cli.bash-linux.dynamodb.errecho
- aws-cli.bash-linux.dynamodb.aws_cli_error_log
services:
dynamodb:
{
Expand Down
111 changes: 111 additions & 0 deletions aws-cli/bash-linux/dynamodb/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<!--Generated by WRITEME on 2023-09-07 15:08:02.300864 (UTC)-->
# DynamoDB code examples for the Command Line Interface with Bash script

## Overview

Shows how to use the AWS Command Line Interface with Bash script to work with Amazon DynamoDB.

<!--custom.overview.start-->
<!--custom.overview.end-->

*DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability.*

## ⚠ Important

* Running this code might result in charges to your AWS account.
* Running the tests might result in charges to your AWS account.
* We recommend that you grant your code least privilege. At most, grant only the minimum permissions required to perform the task. For more information, see [Grant least privilege](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
* This code is not tested in every AWS Region. For more information, see [AWS Regional Services](https://aws.amazon.com/about-aws/global-infrastructure/regional-product-services).

<!--custom.important.start-->
<!--custom.important.end-->

## Code examples

### Prerequisites

For prerequisites, see the [README](../../README.md#Prerequisites) in the `aws-cli` folder.


<!--custom.prerequisites.start-->
<!--custom.prerequisites.end-->

### Single actions

Code excerpts that show you how to call individual service functions.

* [Create a table](dynamodb_operations.sh#L22) (`CreateTable`)
* [Delete a table](dynamodb_operations.sh#L936) (`DeleteTable`)
* [Delete an item from a table](dynamodb_operations.sh#L477) (`DeleteItem`)
* [Get a batch of items](dynamodb_operations.sh#L840) (`BatchGetItem`)
* [Get an item from a table](dynamodb_operations.sh#L382) (`GetItem`)
* [Get information about a table](dynamodb_operations.sh#L126) (`DescribeTable`)
* [List tables](dynamodb_operations.sh#L907) (`ListTables`)
* [Put an item in a table](dynamodb_operations.sh#L200) (`PutItem`)
* [Query a table](dynamodb_operations.sh#L556) (`Query`)
* [Scan a table](dynamodb_operations.sh#L664) (`Scan`)
* [Update an item in a table](dynamodb_operations.sh#L283) (`UpdateItem`)
* [Write a batch of items](dynamodb_operations.sh#L772) (`BatchWriteItem`)

### Scenarios

Code examples that show you how to accomplish a specific task by calling multiple
functions within the same service.

* [Get started with tables, items, and queries](scenario_getting_started_movies.sh)

## Run the examples

### Instructions


<!--custom.instructions.start-->
<!--custom.instructions.end-->



#### Get started with tables, items, and queries

This example shows you how to do the following:

* Create a table that can hold movie data.
* Put, get, and update a single movie in the table.
* Write movie data to the table from a sample JSON file.
* Query for movies that were released in a given year.
* Scan for movies that were released in a range of years.
* Delete a movie from the table, then delete the table.

<!--custom.scenario_prereqs.dynamodb_Scenario_GettingStartedMovies.start-->
<!--custom.scenario_prereqs.dynamodb_Scenario_GettingStartedMovies.end-->


<!--custom.scenarios.dynamodb_Scenario_GettingStartedMovies.start-->
<!--custom.scenarios.dynamodb_Scenario_GettingStartedMovies.end-->

### Tests

⚠ Running tests might result in charges to your AWS account.


To find instructions for running these tests, see the [README](../../README.md#Tests)
in the `aws-cli` folder.



<!--custom.tests.start-->
<!--custom.tests.end-->

## Additional resources

* [DynamoDB Developer Guide](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Introduction.html)
* [DynamoDB API Reference](https://docs.aws.amazon.com/amazondynamodb/latest/APIReference/Welcome.html)
* [Command Line Interface with Bash script DynamoDB reference](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/dynamodb/index.html)

<!--custom.resources.start-->
<!--custom.resources.end-->

---

Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.

SPDX-License-Identifier: Apache-2.0
Loading

0 comments on commit af86eb9

Please sign in to comment.