Giter Site home page Giter Site logo

dynamodb-and-nodejs's Introduction

DynamoDBAndNodejs

Simple POC to use DynamoDB with Node.js

Step-By-Step

  • First install AWS CLI
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

Note that you must have unzip installed. If you don't, install it by running sudo apt-get install unzip

  • Now you must have DynamoDB on the run (AWS) or locally. To install locally, you will need Docker. The image used to run DynamoDB locally is amazon/dynamodb-local. You can run it on your computer by typing on a terminal:
docker run --rm -p 8000:8000 -d amazon/dynamodb-local
  • You`ll need AWS SDK For Javascript in order to run this examples. There are two versions: v2 and v3. The primary changes between them is that v3 is modularized (so you won't need to download every single package out there just to run one service from AWS) and have a middleware stack to control the lifecycle of an operation call. To install v2, do:
yarn add aws-sdk

To install v3 for DynamoDB, do:

yarn add @aws-sdk/client-dynamodb @aws-sdk/lib-dynamodb @aws-sdk/util-dynamodb

You may reference to the commits in order to see the differences between v2 and v3 SDKs.

  • To run locally, you need to AWS configure. To do that, follow this:
$ aws configure
AWS Access Key ID []: local
AWS Secret Access Key []: local
Default region name []: us-east-1
Default output format [None]:

Running this POC

  • Git clone this repository:
git clone https://github.com/Guilospanck/DynamoDBAndNodejs.git
  • Run yarn install to install depedencies.

  • Be sure to have the image in Docker up and running (see Step-By-Step for more information).

  • And then run:

node src/table/createTable.js    // to create a new DynamoDB table
node src/item/insertItem.js      // to insert a new item in the table
node src/item/getItem.js         // to get the new item inserted

Referencies

dynamodb-and-nodejs's People

Contributors

guilospanck avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.