MerLoc is a live AWS Lambda function development and debugging tool. MerLoc allows you to run AWS Lambda functions on your local while they are still part of a flow in the AWS cloud remote.

Overview

MerLoc

license

MerLoc is a live AWS Lambda function development and debugging tool. MerLoc allows you to run AWS Lambda functions on your local while they are still part of a flow in the AWS cloud remote.

For example, let say that you have the following sample serverless architecture for your order application in your AWS account. Sample Architecture

And you are developing the order-notification-service.

With the help of MerLoc, you don’t need to

  • deploy to test your function
  • add debug log statements around code to debug your function
  • re-deploy after every change to check and verify whether it fixes the bug
  • run the function as standalone (without being part of the flow shown above) locally in Docker locally and prepare/provide the input manually

MerLoc makes it possible to

  • test your function locally without deploy to the AWS Lambda environment (so no wait for build, package and deploy)
  • debug your function by putting breakpoints from your IDE
  • hot-reload updated function on your local automatically to apply changes automatically (so again no wait for build, package and deploy)
  • run the individual function locally while it is still part of flow shown above and use real requests from the AWS Lambda environment

Additionally, MerLoc propagates IAM credentials from the real AWS Lambda environment to your local so your local function runs with the same credentials. So this means that you can also test and verify IAM permission issues on your local.

In the example shown above, when you run order-notification-service locally with MerLoc, order-request-service and order-processing-service will run on real AWS Lambda environment, and you will get real published message (by order-processing-service) from real order-notification-topic on your local order-notification-service and run as a part of real flow in the cloud.

Architecture

Architecture

Prerequisites

  • Node.js 14+
  • AWS CDK 2.x
  • Docker

Broker Setup

  • Go to broker stack deploy folder
cd merloc-broker/stack
  • Start deploy
./deploy.sh

Make sure that Docker is up and running before running this command as Docker is used to compile and build broker Lambda functions.

If you want to configure the region to deploy the broker, you can specify it by environment variable. For example to deploy the broker into us-west-2 region:

AWS_REGION=us-west-2 ./deploy.sh
  • Note the broker url. Because we will use this url later to configure the MerLoc AWS Lambda runtime and the MerLoc GateKeeper.

Either you can get it from the AWS CDK outputs, for ex: Broker URL From AWS CDK Output

or from the AWS CloudFormation output, for ex: Broker URL From AWS CloudFormation Output

Runtime Setup

After broker setup is complete, you also need to install following runtime specific (Java, Node.js, Python, ...) components (as shown in the Architecture section):

  • GateKeeper: Allows AWS Lambda functions to communicate with your local runtime through broker
  • Local AWS Lambda runtime: Manages and runs WS Lambda functions on your local

While broker is common for all runtimes, these components need to be installed per supported runtime.

You can check the following links for runtime specific setup for supported runtimes:

Configuration

There are default configurations for the broker in the merloc-broker/stack/.env file. To change the broker configurations, you can update the values in the .env file here and re-deploy the stack by running deploy.sh.

Contributing

Everyone is very welcome to contribute to this repository. Feel free to raise issues or to submit Pull Requests.

License

Licensed under Apache License 2.0.

You might also like...

Vision is a complete project manager where you can colaborate with your team. Everything is still in development phase.

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Jun 4, 2022

Fitness Platform with authentication and more (still in development) πŸ‹οΈβ€β™‚οΈπŸ‹οΈ

Fitness Platform with authentication and more (still in development) πŸ‹οΈβ€β™‚οΈπŸ‹οΈ

LB Fitness readme Fitness platform with authentication containing workout plans, diet and blogs. Explore the docs Β» View Demo Table of Contents About

Dec 19, 2022

"To-do list" is a tool that helps to organize your day. It simply lists the things that you need to do and allows you to mark them as complete. You will build a simple website that allows for doing that, and you will do it using ES6 and Webpack!

To-do-list Description "To-do list" is a tool that helps to organize your day. It simply lists the things that you need to do and allows you to mark t

Oct 18, 2022

Multithread emulator. The wrun allows you to dynamically run a function inside a Web Worker on the client side, without the needing of a dedicated file

wrun This lib allows you to dynamically run a function inside a Web Worker on the client side, without the needing of a dedicated file. This means tha

Nov 5, 2022

This blog is still under development! I present a project scope for science articles, it can now be used in production! But there are some details that need to be put up front.

Science-Blog πŸ›‘ Attention! This blog is still under development! I present a project scope for science articles, it can now be used in production! But

Sep 19, 2022

The cloud computing part required by the Rebage application ☁

Rebage - Cloud Computing The cloud technology used in Rebage Powered by: Google Cloud Platform, offered by Google, is a suite of cloud computing servi

Sep 25, 2022

Learn Web 2.0 and Web 3.0 Development using Next.js, Typescript, AWS CDK, AWS Serverless, Ethereum and AWS Aurora Serverless

Learn Web 2.0 Cloud and Web 3.0 Development in Baby Steps In this course repo we will learn Web 2.0 cloud development using the latest state of the ar

Jan 3, 2023

A superfast and easy to use knowledge base to help your customers get the info they need, when they need it most.

A superfast and easy to use knowledge base to help your customers get the info they need, when they need it most.

A superfast and easy to use knowledge base to help your customers get the info they need, when they need it most. helpkb is an open-source Next.js (A

Dec 5, 2022
Comments
  • Feature Request: Nodejs Runtime Support

    Feature Request: Nodejs Runtime Support

    This looks like a great project. I see we have Java Runtime Support, but I would love to have support for Nodejs as well. I write a lot of TypeScript and I would definitely use this software.

    opened by misterjoshua 5
  • Feature Request: Publish the Broker as a CDK Construct Lib

    Feature Request: Publish the Broker as a CDK Construct Lib

    Please publish the MerLoc Broker as an AWS CDK v2 Construct Lib.

    Use Case

    We'd like to add the MerLoc Broker to our existing CDK App so that it comes for free in our developers' environments. This would simplify MerLoc's setup for our entire team.

    Example

    /** Use the MerLocBroker's addLambdaFunction */
    export class MyStack extends Stack {
      constructor(scope: Construct, id: string, props: StackProps = {}) {
        super(scope, id, props);
    
        // I add a MerLoc broker to my existing app.
        const merLocBroker = new MerLocBroker(this, 'MerLocBroker');
    
        // Lets say I have a specific function I want to configure to use the broker.
        const handler = new aws_lambda.Function(this, 'MyFunction', {...});
        // I add the lambda function to the MerLocBroker, and this auto-configures
        // the function with the correct layer and environment variables to use the broker.
        merLocBroker.addLambdaFunction(handler);
      }
    }
    
    /** An aspect-based approach */
    export class MyStack2 extends Stack {
      constructor(scope: Construct, id: string, props: StackProps = {}) {
        super(scope, id, props);
    
        // Lets say this is my app - I have data and control planes.
        const myAppData = new MyAppData(this, 'MyAppData');
        new MyAppControl(this, 'MyAppControl', {
          myAppData,
        });
    
        // I add a MerLoc broker to my existing app.
        const merLocBroker = new MerLocBroker(this, 'MerLocBroker');
        // Then add an aspect that auto-configures all my lambdas with the correct
        // layer and environment variables to use the broker.
        Aspects.of(this).add(
          new MerLocConfigAspect(merLocBroker),
        );
      }
    }
    
    opened by misterjoshua 0
Owner
Thundra
Discover bottlenecks and detect issues in development, test, staging, and production faster!
Thundra
AWS Lambda & Serverless - Developer Guide with Hands-on Labs. Develop thousands line of aws lambda functions interact to aws serverless services with real-world hands-on labs

AWS Lambda & Serverless - Developer Guide with Hands-on Labs UDEMY COURSE WITH DISCOUNTED - Step by Step Development of this Repository -> https://www

awsrun 35 Dec 17, 2022
Marquee is a VS Code extension designed to naturally integrate with your development flow, so that you will no longer lose track of your thoughts while you're coding

Marquee Stay organized with minimal context switching, all inside your Visual Studio Code. Marquee is a VS Code extension designed to naturally integr

stateful 60 Dec 13, 2022
A monorepo that uses the AWS Cloud Development Kit to deploy and configure nanomdm on AWS lambda.

NanoMDM on AWS This repo builds and configures a nanomdm server to run on AWS lambda. It uses the Cloud Development Kit and tries to follow best pract

Stevie Clifton 4 May 26, 2022
zkPoB is a mobile compatible tool that lets anyone prove they own a Bufficorn (or any NFT) without revealing which Buffi they own or the address they are verifying themselves with

zkPoB is a mobile compatible tool that lets anyone prove they own a Bufficorn (or any NFT) without revealing which Buffi they own or the address they are verifying themselves with

Marto.eth 10 Aug 25, 2022
Everynode allows you to run any version of Node.js in AWS Lambda, in any commercial AWS region

Run Any Node.js Version in AWS Lambda Everynode allows you to run any version of Node.js in AWS Lambda, in any commercial AWS region. We add support f

Fusebit 116 Dec 15, 2022
A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM deffiniation and appropriate file structure.

Welcome to function-stencil ?? A quickstart AWS Lambda function code generator. Downloads a template function code file, test harness file, sample SAM

Ben Smith 21 Jun 20, 2022
Blobernize your pictures with this all-new tool! Still under development, but it works for now.

Still under development, but in a usable state image-blobernizer A very simple image-blobernizer made for the webbrowser using p5.js Live demo Require

Sen van der Heide 3 Mar 23, 2022
A serverless AWS expense tracker API. AWS Lambda functions, API gateway, and Dynamodb are among the ingredients.

AWS-Serverless-API A serverless AWS expense tracker API. AWS Lambda functions API gateway Dynamodb Endpoints Create a new expense: Method: POST Body f

Ondiek Elijah Ochieng 1 Jul 16, 2022
A web app which help you to save you a list of your favorite books, they will be saved on your local storage to never loose them even if you close the page. Built wiht JavaScript

Awesome Books In this project I build a page to save a list of your favorites books, you can add new books, delete it and they will be saved in the lo

Williams Colmenares 9 Dec 17, 2022