Skip to content

OCLC-Developer-Network/c4l_serverless_iot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#Internet of Things Triggered Lambda

Custom application is triggered by an IOT device

##Installing Locally

Step 1: Clone the repository

Clone this repository

$ git clone {url}

or download directly from GitHub.

Change into the application directory

Step 2: Use npm

Download node and npm and use the install command to read the dependencies JSON file

$ npm install

Step 3: Configure application

Step 4: AWS Setup

  1. Install AWS Commandline tools
  1. Create an AWS user in IAM console. Give it appropriate permissions. Copy the key and secret for this user to use in the CLI.
  2. Configure the commandline tools - https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html
  • Make sure you add -- key/secret -- region

Step 5: Encrypt your Credentials

  1. Create a KMS key

  2. Encrypt the config file

$ aws kms encrypt --key-id {key-id} --plaintext fileb://prod_config.yml --output text --query CiphertextBlob --output text | base64 -D > prod_config_encrypted.txt

Step 6: Test application

  1. Alter iot_event.json

  2. Use serverless to test locally

serverless invoke local --function checkOCLCNumber --path iot_event.json

##Installing in AWS Lambda

  1. Download and setup the application, see Installing locally
  2. Edit serverless.yml so it include your key ARN
service: 
    name: iot-trigger-test
    awsKmsKeyArn: arn:aws:kms:us-east-1:XXXXXX:key/some-hash
  1. Deploy the code using serverless
$ serverless deploy
  1. Make sure the role for the Lambda has the right permissions
  • KMS decrypt
  1. Setup the trigger

About

No description or website provided.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published