Giter Club home page Giter Club logo

awssamplestarterapp's Introduction

BSS Dev Sample Node App

Sample node app for processing SQS messages, that you can run locally using AWS SAM.
You can use this as a starter repository for new projects to get started quickly :)

Installation

Things you need installed:

  1. Node 12.x and npm --> https://nodejs.org/en/download/
  2. AWS Sam --> https://aws.amazon.com/serverless/sam/

Initial Setup

Is this your first time? Then you need to install the node modules, see below

npm install

Quick Start: I want to....

1. Have my lambda triggered via an sqs message (index_sqs.ts):

npm run package && sam build && sam local invoke SQSFunction --event events/event-sqs.json

2. Use Dynamo (index_dynamo.ts):

Login with with BSS cli to dev account
npm run package && sam build && sam local invoke DynamoFunction

3. Use Secrets Manager (index_secrets.ts):

Login with with BSS cli to dev account
npm run package && sam build && sam local invoke SecretsFunction

Ongoing Usage

After you ran npm install

npm run package
sam build
sam local invoke SQSFunction --event events/event-sqs.json

OR the shorthand way:

npm run package && sam build && sam local invoke SQSFunction --event events/event-sqs.json

So what do the above commands do for you?

  1. npm run package: Converts the typescript for you into javascript so that Lambda can run it
  2. sam build: Tells AWS SAM to read the template.yaml file which packages up the node app in a friendly way for the SAM app to call it like a lambda function
  3. sam local invoke SQSFunction --event events/event-sqs.json: Tells SAM to run the app locally and trigger the handler with that event, in this case it's an SQS event

Why?

The AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications. It provides shorthand syntax to express functions, APIs, databases, and event source mappings. With just a few lines per resource, you can define the application you want and model it using YAML. During deployment, SAM transforms and expands the SAM syntax into AWS CloudFormation syntax, enabling you to build serverless applications faster.

awssamplestarterapp's People

Contributors

kfatkin avatar

Watchers

 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.