The plugin can register triggers (events) for a lambda function dynamically at the time of the deployment. The usual static trigger (event) definitions can be completely omitted. The original idea is to make the same lambda function triggered by different events on different environments (stages). This way we can even do some basic feature switching.
The plugin when the host code gets deployed...
Please note that you can only use the plugin with sns, sqs or kinesis triggers.
Like on dev foo lambda function is triggered by
While on prod foo lambda function is triggered by
This way we can switch features on and off on different stages.
The dynamic trigger sets need to be stored in the Parameter Store of the Systems Manager (SSM) and it should look somewhat like this:
or
The configuration in the serverless.yml:
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: "handler1" ssmPath: "/${opt:stage}/trigger-set1" // This is the dynamic part :) - name: "handler2" ssmPath: "/${opt:stage}/trigger-set2" // This is the dynamic part :) // Further down in the serverless.yml handler1: handler: src/handler1 name: ${self:service}-handler1 // No events section needed handler2: handler: src/handler1 name: ${self:service}-handler2 // No events section needed
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4