Skip to content

failsafe-engineering/serverless-aws-lambda-dynamic-trigger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Modules

js

The plugin can register triggers (events) for a lambda function dynamically. At deployment time

  1. It fetches the value of a parameter in the Parameters. The value must be a list ARNs sepearted by comma.
  2. Parses the individual ARNs.
  3. Register the ARNs as triggers with the configured lambda function or functions.

Please note that currently you can only use the plugin with sns, sqs or kinesis triggers (events).

The original idea is to make the same lambda function triggered by different events on different environments (stages). Like on dev foo lambda function is triggered by

  • arn:aws:sns:eu-west-2:123456654321:topic1
  • arn:aws:sns:eu-west-2:123456654321:topic2
  • arn:aws:sns:eu-west-2:123456654321:topic3 while on prod foo lambda function is triggered by
  • arn:aws:sns:eu-west-2:123456654321:topic1
  • arn:aws:sns:eu-west-2:123456654321:topic2 This way we can switch features on and off on different stages.

The dynamic trigger sets needs to ne stored in the Parameter Store of the Systems Manager (SSM) and it should look somewhat like this: Name: /dev/dynamic-trigger Value: arn:aws:sns:eu-west-2:123456654321:topic1,arn:aws:sns:eu-west-2:123456654321:topic2,arn:aws:sns:eu-west-2:123456654321:topic3 or Name: /prod/dynamic-trigger Value: arn:aws:sns:eu-west-2:123456654321:topic1,arn:aws:sns:eu-west-2:123456654321:topic2

The config parameters:

  • region: the region of the Systems Manager -> Parameter Store
  • functions:
    • name: The name of the function

plugins:

  • @kakkuk/serverless-aws-lambda-dynamic-trigger custom: dynamicTrigger: region: "eu-west-2" // !!! Optional !!! It'll fall back to AWS_DEFAULT_REGION if it's not set functions:
    • name: "handler" ssmPath: "{/path/to/triggers}"

Members

Package @kakkuk/serverless-aws-lambda-dynamic-trigger

Serverless plugin registers a set of events stored in the AWS Parameter Store.

js

The plugin can register triggers (events) for a lambda function dynamically. At deployment time

  1. It fetches the value of a parameter in the Parameters. The value must be a list ARNs sepearted by comma.
  2. Parses the individual ARNs.
  3. Register the ARNs as triggers with the configured lambda function or functions.

Please note that currently you can only use the plugin with sns, sqs or kinesis triggers (events).

The original idea is to make the same lambda function triggered by different events on different environments (stages). Like on dev foo lambda function is triggered by

  • arn:aws:sns:eu-west-2:123456654321:topic1
  • arn:aws:sns:eu-west-2:123456654321:topic2
  • arn:aws:sns:eu-west-2:123456654321:topic3 while on prod foo lambda function is triggered by
  • arn:aws:sns:eu-west-2:123456654321:topic1
  • arn:aws:sns:eu-west-2:123456654321:topic2 This way we can switch features on and off on different stages.

The dynamic trigger sets needs to ne stored in the Parameter Store of the Systems Manager (SSM) and it should look somewhat like this: Name: /dev/dynamic-trigger Value: arn:aws:sns:eu-west-2:123456654321:topic1,arn:aws:sns:eu-west-2:123456654321:topic2,arn:aws:sns:eu-west-2:123456654321:topic3 or Name: /prod/dynamic-trigger Value: arn:aws:sns:eu-west-2:123456654321:topic1,arn:aws:sns:eu-west-2:123456654321:topic2

The config parameters:

  • region: the region of the Systems Manager -> Parameter Store
  • functions:
    • name: The name of the function

plugins:

  • @kakkuk/serverless-aws-lambda-dynamic-trigger custom: dynamicTrigger: region: "eu-west-2" // !!! Optional !!! It'll fall back to AWS_DEFAULT_REGION if it's not set functions:
    • name: "handler" ssmPath: "{/path/to/triggers}"

Package @kakkuk/serverless-aws-lambda-dynamic-trigger

Serverless plugin registers a set of events stored in the AWS Parameter Store.

Kind: global variable

About

Dynamic triggers for was lambda functions

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •