Skip to content

jweisman/Alma-AWS-Lambda

Repository files navigation

AWS Lambda Samples for Alma

Introduction

This repository provides small examples of using Amazon Web Service's Lambda service with Alma use cases. Each example is self-contained and sits in its own directory in this repository.

Installation and Testing Instructions

On any machine with Node.js and Git installed, do the following:

  1. Clone this repository: git clone https://github.com/jweisman/AWS-Lambda-POC.git
  2. In the relevant directory, install dependencies: npm install
  3. If available, copy the config-example.json file to config.json and replace the placeholder values.
  1. Test the application locally with a test script (see below)
  2. Package the application with the node_modules into a zip file
  3. Upload the zip to a Lambda function previously-defined in AWS using the console or the CLI:
aws lambda update-function-code --function-name MyFunctionName --zip-file fileb://MyFunctionZip.zip 

Testing the Script

You can test the Lambda function locally using a script such as the one below:

// Our Lambda function fle is required
var myLambda = require('./index.js');

// The Lambda context "done" function is called when complete with/without error var context = {
    done: function (err, result) {
        console.log('------------');
        console.log('Context done');
        console.log('   error:', err);
        console.log('   result:', result);
    }
};

// Create an event if required for your function
var event = {

};

// Call the Lambda function
myLambda.handler(event, context);

License

The code for these samples is made available under the MIT license.

About

AWS Lambda functions for Alma

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published