Giter VIP home page Giter VIP logo

serverless-lambda-defaults-plugin's Introduction

Serverless Lambda Defaults Plugin

Architecture

This plugin creates a default lambda setup for each function defined in your serverless configuration. The lambda includes a dead-letter-queue, lambda insights extension, and 5 alerts including an SNS topic. All settings are configurable at the plugin and individual function level.

Default Configuration

The default configuration that can be overriden at plugin and function level.

{
    dlq: {
      enabled: true,
      alarms: {
        enabled: true,
        deadLetterErrors: {
          enabled: true,
          treatMissingData: "notBreaching",
          evaluationPeriods: 2,
          dataPointsToAlarm: 2,
          period: 60,
          statistic: "Sum",
          threshold: 1,
        },
        deadLetterMessages: {
          enabled: true,
          treatMissingData: "notBreaching",
          period: 60,
          evaluationPeriods: 1,
          dataPointsToAlarm: 1,
          statistic: "Sum",
          threshold: 1,
        },
      },
    },
    insights: {
      enabled: true,
      version: 14,
      alarms: {
        enabled: true,
        excessiveMemoryUsage: {
          enabled: true,
          threshold: 75, // percent threshold of memory utilized vs max memory
          treatMissingData: "ignore",
          evaluationPeriods: 2,
          dataPointsToAlarm: 2,
          period: 60,
          statistic: "Average",
        },
      },
    },
    alarms: {
      enabled: true,
      excessiveExecutionTime: {
        enabled: true,
        threshold: undefined, // default is calculated based on 75% of the lambda's configured timeout
        statistic: "Average",
        treatMissingData: "ignore",
        dataPointsToAlarm: 1,
        evaluationPeriods: 1,
        period: 60,
      },
      throttleErrors: {
        enabled: true,
        treatMissingData: "notBreaching",
        period: 60,
        evaluationPeriods: 2,
        dataPointsToAlarm: 2,
        statistic: "Sum",
        threshold: 1,
      },
    },
}

Examples

An example is included in the folder examples.

Here is a basic serverless yaml setup.

service: sample

provider:
  name: aws
  runtime: python3.8
  timeout: 30

custom:
  lambdaDefaults:
    insights:  # override at the plugin level
      enabled: false

plugins:
  - serverless-lambda-defaults-plugin

package:
  exclude:
    - "**/*"
  include:
    - '!.**'
    - index.py

functions:
  ping:
    handler: index.lambda_handler
    events:
      - http:
          path: /
          method: get

  pong:
    handler: index.lambda_handler
    lambdaDefaults:
      alarms:  # override at the function level
        excessiveExecutionTime:
          threshold: 15
    events:
      - http:
          path: /
          method: get

serverless-lambda-defaults-plugin's People

Watchers

James Cloos avatar Kory Taborn avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.