Serverless Plugin Registry

homepage icon https://github.com/aronim/serverless-plugin-registry
Follow @aronim

Tracked

NPM Downloads Last Month
18
Issues
0
Stars
0
Forks
0
Watchers
0
Watch Star Fork Issue Download License NPM Build Status Coverage Status Contributors

Repo README Contents:

Serverless Registry Plugin

serverless npm version npm downloads license

Register function names with AWS SSM Parameter Store

Requirements:

How it works

This plugin creates an SSM Parameter with your functions’ fully qualified Lambda Function names as values. The main motivation for this plugin is to remove the dependency that any client code would have on the AWS Stack, as the stack name is part of the fully qualified Lambda Function name. Using this plugin, it is easier to move functions between stacks with out less changes to client code and configuration.

Caveats

One caveat is the fact that any IAM policies that are written for these functions will still need to be updated. In the case of Serverless configuration, if you use the built-in SSM Parameter resolution, then it might be as simple as just redeploying any client upstream services.

Setup

Install via npm in the root of your Serverless service:

npm install serverless-plugin-registry --save-dev
plugins:
  - serverless-plugin-registry

Default Behavior

service: ServerlessPluginRegistry

provider:
  stage: ${opt:stage, "Test"}

functions:
  Hello:
    handler: hello.js

This will produce an SSM Parameter with

Global Base Name

service: ServerlessPluginRegistry

provider:
  stage: ${opt:stage, "Test"}

custom:
  registry:
    baseName: /Registry/${self:provider.stage}

functions:
  Hello:
    handler: hello.js

This will produce an SSM Parameter with

Function Base Name

service: ServerlessPluginRegistry

provider:
  stage: ${opt:stage, "Test"}

functions:
  Hello:
    handler: hello.js    
    registry:
      baseName: /Registry/${self:provider.stage}

This will produce an SSM Parameter with

Only Publish Select Functions

service: ServerlessPluginRegistry

provider:
  stage: ${opt:stage, "Test"}

functions:
  Hello:
    handler: hello.js    
    registry:
      baseName: /Registry/${self:provider.stage}
  HowAreYou:
    handler: howAreYou.js    
    registry:
      register: true
  Goodbye:
    handler: goodbye.js    

This will only produce two SSM Parameters with

Contribute

Help us making this plugin better and future proof.

License

This software is released under the MIT license. See the license file for more details.