0

I'm trying to create a REST API with aws (Nodejs) and dynamodb. Most of the time I do not have access to AWS and I need to have everything running offline to test and only deploy when I have an amount of work done. Is there any guide or good practices that help me in the development?

Thanks in advance!

NoSQLKnowHow
  • 4,449
  • 23
  • 35
Conde
  • 785
  • 15
  • 31

3 Answers3

4

you can run offline version of dynamodb on your localhost. The easiest is to have it in container in docker. Then you dont have to manage it at all and it will work in every environment that has docker installed.

This is what we have in package.json scripts for serverless application

    "start": "sls offline start",
    "start-local": "npm run force-dynamo sls offline start --stage=localhost",
    "force-dynamo": "npm run stop-dynamo && npm run start-dynamo",
    "start-dynamo": "docker run -d -p 8000:8000 dwmkerr/dynamodb -sharedDb",
    "stop-dynamo": "docker stop $(docker ps -a -q --filter ancestor=dwmkerr/dynamodb --format=\"{{.ID}}\")",

However if you do not care that much about CI/CD pipeline or reusability on multiple devices -> you can just install dynamoDB, run it and based on configuration just target your offline/online dynamodb.

libik
  • 22,239
  • 9
  • 44
  • 87
0

AWS localstack is good choice for local development of serverless apps

Aniket Chopade
  • 801
  • 5
  • 12
  • Can you provide more details? Why is it a good choice? Can you link any documentation or supporting materials or provide any sample code/configuration? – Matthew Pope Mar 04 '19 at 18:36
0

Use Sam Local for the lambda part and DynamoDB Local for the DynamoDB part. I recommend running DynamoDB local using the docker container like libik mentions.

NoSQLKnowHow
  • 4,449
  • 23
  • 35