Skip to content

sr-shifu/app-composer-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Find more details in my post.

Development Environment Prerequisites

Setup

  1. Clone this repo.

  2. Create Docker network (do it once in your first setup): docker network create sam-demo-net

  3. Start DynamoDB Local by executing the following at the command prompt:
    docker run -p 8000:8000 --network sam-demo-net --name ddblocal amazon/dynamodb-local
    This will run the DynamoDB local in a docker container at port 8000.

  4. At the command prompt, list the tables on DynamoDB Local by executing:
    aws dynamodb list-tables --endpoint-url http://localhost:8000

  5. An output such as the one shown below confirms that the DynamoDB local instance has been installed and running:
    {
    "TableNames": []
    }

  6. At the command prompt, create the ToDosTable by executing:
    aws dynamodb create-table --cli-input-json file://json/create-todos-table.json --endpoint-url http://localhost:8000

    Note: If you misconfigured your table and need to delete it, you may do so by executing the following command:
    aws dynamodb delete-table --table-name ToDosTable --endpoint-url http://localhost:8000

  7. At the command prompt, start the local API Gateway instance by executing:
    sam local start-api --env-vars json/env.json --docker-network sam-demo-net

Testing the application

  1. Insert a ToDo item in the table by executing the following CURL command at the prompt:
    curl -X POST -d '{"title": "test ToDo"}' http://127.0.0.1:3000/todos

  2. Let's retrieve ToDo items from the local DynamoDB instance by executing the following CURL command at the prompt:
    curl http://127.0.0.1:3000/todos

  3. To update ToDo item, run this command:

curl -X PUT -d '{"title": "test ToDo (completed)", "isCompleted": true}' http://127.0.0.1:3000/todos/UUID

Note: replace UUID with real item id.

About

Demo package for AWS App Composer + SAM + DynamoDB

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published