1.1.0 • Published 4 years ago

serverless-plugin-tag-events v1.1.0

Weekly downloads
161
License
MIT
Repository
github
Last release
4 years ago

serverless-plugin-tag-events

A Serverless-framework plugin to tag various events of AWS Lambda function.

Features

  • Tag & Untag is supported on following events:
    • SNS
    • Schedule
  • Uses provider level tags & resoruce level tags(such as events.sns tags, event.schedule tags)
  • Resource level tags will have higher priority over provider level tags

Installation

yarn add serverless-plugin-tag-events

then add it in your plugins list:

plugins:
  - serverless-plugin-tag-events

Tags Configuration

Using the tags configuration makes it possible to add key / value tags to your SNS Topic or Event schedule.

Those tags will appear in your AWS console and make it easier for you to group functions by tag or find functions with a common tag.

functions:
  hello:
    handler: handler.hello
    events:
      - sns:
          topicName: aggregate
          displayName: Data aggregation pipeline
          tags:
            foo: bar
      - schedule:
          name: test
          description: 'test schedule'
          rate: rate(5 minutes)
          enabled: false
          input: '{}'
          tags:
            foo: bar

Or if you want to apply tags configuration to all topics/schedules in your service, you can add the configuration to the higher level provider object.

Tags configured at the sns level are merged with those at the provider level, so your topic/schedule with specific tags will get the tags defined at the provider level.

If a tag with the same key is defined at both the function and provider levels, the function-specific value overrides the provider-level default value. For example:

# serverless.yml
service: service-name
provider:
  name: aws
  tags:
    foo: bar
    baz: qux
    envionment: development
functions:
  hello:
    handler: handler.hello
    events:
      - sns:
          topicName: aggregate
          displayName: Data aggregation pipeline
          tags:
            foo: quux
      - schedule:
          name: test
          description: 'test schedule'
          rate: rate(5 minutes)
          enabled: false
          input: '{}'
          tags:
            foo: bar

License

MIT