Giter Site home page Giter Site logo

aws-serverless-node-red's Introduction

Node-RED on AWS Lambda using Amazon API Gateway and S3

Overview

overview

Quick Start

Steps for running the Node-RED on lambda using API Gateway and S3

This guide assumes you have already set up an AWS account and have the latest version of the AWS CLI installed.

  1. From your preferred project directory:

    git clone https://github.com/sakazuki/aws-serverless-node-red.git
    cd aws-serverless-node-red
    
  2. Run the following command to configure with your variables.

    AWS_ACCOUNT_ID=123456789012
    S3_BUCKET=node-red123
    AWS_REGION=us-west-2
    AWS_FUNCNAME=funcname123
    AWS_STACK_NAME=Node-RED
    npm run config -- --account-id="${AWS_ACCOUNT_ID}" \
    --bucket-name="${S3_BUCKET}" \
    --region="${AWS_REGION}" \
    --function-name="${AWS_FUNCNAME}" \
    --stack-name="${AWS_STACK_NAME}"
    

    This modifies the following files with your account ID, bucket, region, function name and stack name (region defaults to us-east-1 and function name defaults to slsNodeREDFunction).

    • package.json
    • simple-proxy-api.yaml
    • cloudformation.yaml
    • settings.js

    If the bucket you specify does not yet exist, the next step will create it for you. This step modifies the existing files in-place; if you wish to make changes to these settings, you will need to modify these files manually.

  3. Run the following command to installs the node dependencies, creates an S3 bucket (if it does not already exist), packages and deploys your serverless Express application to AWS Lambda, and creates an API Gateway proxy API.

    npm run setup
    
    ### Windows users:
    npm run win-setup
    
  4. Make a Node-RED flow on local PC

    node node_modules/.bin/node-red -s ./settings.js
    

    open http://localhost:1880 and make a flow using a HTTP in node. You can test it with local PC. flow.json is saved on S3 bucket.

  5. After the local test, You can test it using API Gateway.
    open the AWS CloudFormation console https://console.aws.amazon.com/cloudformation/home and switch to the region you specified. Select the slsNodeREDStack stack, then click the ApiUrl value under the Outputs section - this will open a new page with your running API.
    Or
    you can get ApiUrl from the output of the following command.

    aws cloudformation describe-stacks --stack-name ${AWS_STACK_NAME} \
    --output json --query "Stacks[*].Outputs"
    
  6. If you would prefer to delete AWS assets that were just created, simply run npm run delete-stack to delete the CloudFormation Stack, including the API and Lambda Function. If you specified a new bucket in the config command for step 1 and want to delete that bucket, run npm run delete-bucket.

Version

  • Node.js version 8.12
  • Node-RED version 0.20.5

Resource

this directory includes

Reference

See the more details on how to customize an existing (or create a new) Node.js project based on this example.

aws-serverless-node-red's People

Contributors

sakazuki avatar dependabot[bot] avatar

Watchers

James Cloos 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.