{"id":16323240,"url":"https://github.com/lironer/serverless-aws-alarms","last_synced_at":"2025-07-03T22:05:21.311Z","repository":{"id":210401732,"uuid":"712475284","full_name":"LironEr/serverless-aws-alarms","owner":"LironEr","description":"Serverless framework plugin that easily creates CloudWatch alarms for lambdas","archived":false,"fork":false,"pushed_at":"2025-02-22T17:11:40.000Z","size":288,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-03T22:04:39.802Z","etag":null,"topics":["aws-cloudwatch","aws-lambda","serverless-framework"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LironEr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"LironEr","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":"lironer","otechie":null,"lfx_crowdfunding":null,"custom":["https://www.paypal.com/donate?hosted_button_id=YZL6KM2UGB5ML"]}},"created_at":"2023-10-31T14:42:11.000Z","updated_at":"2025-03-21T10:15:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"ee6baa74-0ccf-4065-ac81-aa6cbec6fcf1","html_url":"https://github.com/LironEr/serverless-aws-alarms","commit_stats":null,"previous_names":["lironer/serverless-aws-alarms"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/LironEr/serverless-aws-alarms","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LironEr%2Fserverless-aws-alarms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LironEr%2Fserverless-aws-alarms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LironEr%2Fserverless-aws-alarms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LironEr%2Fserverless-aws-alarms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LironEr","download_url":"https://codeload.github.com/LironEr/serverless-aws-alarms/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LironEr%2Fserverless-aws-alarms/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263410760,"owners_count":23462296,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-cloudwatch","aws-lambda","serverless-framework"],"created_at":"2024-10-10T22:54:19.670Z","updated_at":"2025-07-03T22:05:21.205Z","avatar_url":"https://github.com/LironEr.png","language":"TypeScript","funding_links":["https://github.com/sponsors/LironEr","https://issuehunt.io/r/lironer","https://www.paypal.com/donate?hosted_button_id=YZL6KM2UGB5ML"],"categories":[],"sub_categories":[],"readme":"# Serverless AWS Alarms Plugin\n\n[![serverless](http://public.serverless.com/badges/v3.svg)](https://www.serverless.com)\n[![npm](https://img.shields.io/npm/v/serverless-aws-alarms)](https://www.npmjs.com/package/serverless-aws-alarms)\n[![node](https://img.shields.io/node/v/serverless-aws-alarms)](https://github.com/LironEr/serverless-aws-alarms)\n[![serverless](https://img.shields.io/npm/dependency-version/serverless-aws-alarms/peer/serverless.svg)](https://github.com/serverless/serverless)\n[![license](https://img.shields.io/npm/l/serverless-aws-alarms)](https://www.npmjs.com/package/serverless-aws-alarms)\n\nServerless framework plugin that easily creates CloudWatch alarms for lambdas.\n\n## Usage\n\n```yml\nservice: service-name\n\nplugins:\n  - serverless-aws-alarms\n\ncustom:\n  awsAlarms:\n    stages: # optional - select which stages to deploy alarms to\n      - staging\n      - production\n\n    actions:\n      default: # optional - default actions for all alarms\n        ok: arn:aws:sns:${self:provider.region}:${aws:accountId}:my-team-alerts-ok\n        alarm: arn:aws:sns:${self:provider.region}:${aws:accountId}:my-team-alerts-alarm\n        insufficientData: arn:aws:sns:${self:provider.region}:${aws:accountId}:my-team-alerts-insufficient-data\n      critical: # optional - create more actions\n        ok: !Ref MyTeamCriticalAlertsTopic # you can also use !Ref and other CloudFormation functions\n        alarm: !ImportValue 'my-team-alerts'\n\n    defaults:\n      nameTemplate: $[functionName]-$[metricName]-alarm # Optional - naming template for alarms, can be overwritten in definitions\n      prefixTemplate: $[stackName] # Optional - override the alarm name prefix\n      suffixTemplate: alarm # Optional - override the alarm name suffix\n      tags:\n        TEAM: my-team\n\n    definitions: # these defaults are merged with your definitions\n      lambdaErrors:\n        enabled: true\n        period: 300 # override period\n      lambdaTimeout:\n        enabled: true\n        period: 300 # override period\n        threshold: 2000 # override threshold\n        okActions:\n          - critical\n        alarmActions:\n          - critical\n        insufficientDataActions: [] # override insufficientDataActions to empty array (instead of using default)\n      customAlarm: # create new alarm\n        enabled: false\n        prefixTemplate: $[stackName] # Optional - override the alarm name prefix\n        nameTemplate: $[functionName]-high-duration-alarm # Optional - override the alarm name\n        description: 'My custom alarm'\n        namespace: 'AWS/Lambda'\n        metric: Duration\n        threshold: 200\n        statistic: Average\n        period: 300\n        evaluationPeriods: 1\n        datapointsToAlarm: 1\n        comparisonOperator: GreaterThanOrEqualToThreshold\n\nprovider:\n  name: aws\n  runtime: nodejs18x\n\nfunctions:\n  foo:\n    name: ${self:service}-foo\n    handler: foo.handler\n    alarms: # merged with definitions\n      customAlarm:\n        enabled: true\n      someAlarm: # creates new alarm for this lambda or overwrite some properties of the alarm (with the same name) from definitions\n        namespace: 'AWS/Lambda'\n        metric: Errors\n        threshold: 1\n        statistic: Minimum\n        period: 60\n        evaluationPeriods: 1\n        datapointsToAlarm: 1\n        comparisonOperator: GreaterThanOrEqualToThreshold\n        actionsEnabled: false\n```\n\n### Alarm defenition\n\nDetailed description of the properties can be found in the [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudwatch-alarm.html).\n\n| name                    | description                                                                                            | type                                                       | default                           |\n| ----------------------- | ------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------- | --------------------------------- |\n| enabled                 | Indicates whether the alarm will be created or not                                                     | `boolean`                                                  | `false`                           |\n| prefixTemplate          | Prefix alarm name                                                                                      | `string`                                                   | `''`                              |\n| nameTemplate            | The name of the alarm                                                                                  | `string`                                                   | `$[lambdaName]-$[definitionName]` |\n| description             | The description of the alarm                                                                           | `string`                                                   |                                   |\n| namespace               | The namespace of the metric associated with the alarm                                                  | `string`                                                   |                                   |\n| metric                  | The name of the metric associated with the alarm                                                       | `string`                                                   |                                   |\n| comparisonOperator      | The arithmetic operation to use when comparing the specified statistic and threshold                   | `string`                                                   |                                   |\n| statistic               | The statistic for the metric associated with the alarm                                                 | `string`                                                   |                                   |\n| threshold               | The value to compare with the specified statistic                                                      | `number`                                                   |                                   |\n| period                  | The period, in seconds, over which the statistic is applied                                            | `number`                                                   |                                   |\n| evaluationPeriods       | The number of periods over which data is compared to the specified threshold                           | `number`                                                   |                                   |\n| datapointsToAlarm       | The number of datapoints that must be breaching to trigger the alarm                                   | `number`                                                   |                                   |\n| actionsEnabled          | Indicates whether actions should be executed during any changes to the alarm state                     | `boolean`                                                  |                                   |\n| okActions               | The actions to execute when this alarm transitions to the OK state from any other state                | `string[]`                                                 |                                   |\n| alarmActions            | The list of actions to execute when this alarm transitions into an ALARM state from any other state    | `string[]`                                                 |                                   |\n| insufficientDataActions | The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state | `string[]`                                                 |                                   |\n| treatMissingData        | Sets how this alarm is to handle missing data points                                                   | `string`                                                   |                                   |\n| tags                    | Sets alarm tags                                                                                        | `Record\u003cstring, string\u003e`                                   |                                   |\n| metricFilter            | Create an alarm based on a pattern found in a log group                                                | [`AlarmMetricFilterDefinition`](#metric-filter-definition) |                                   |\n\n### Metric filter definition\n\nDetailed description of the properties can be found in the [AWS documentation](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-metricfilter.html).\n\n| name         | description                                                                                                                                           | type                  | default                                     |\n| ------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------------------------------------- |\n| pattern      | A filter pattern for extracting metric data out of ingested log events. For more information, see [Filter and Pattern Syntax][FilterAndPatternSyntax] | `string` **required** |                                             |\n| metricValue  | The value that is published to the CloudWatch metric                                                                                                  | `string` \\| `number`  |                                             |\n| defaultValue | The value to emit when a filter pattern does not match a log event                                                                                    | `number`              |                                             |\n| nameTemplate | The name of the metric filter                                                                                                                         | `string`              | `$[lambdaName]$[definitionName]AlarmFilter` |\n\n### Name template placeholders\n\nYou can use the following placeholders in the `nameTemplate` and `prefixTemplate` properties:\n\n- `stackName` - the name of the stack\n- `lambdaName` - the name of the lambda\n- `lambdaId` - the name of the lambda resource (the key in `functions` section)\n- `lambdaLogicalId` - the name of the lambda resource in the CloudFormation template\n- `metricName` - the name of the metric (from alarm defenition)\n- `definitionName` - the name of the alarm definition\n\nUsage example:\n\n```yml\nnameTemplate: $[stackName]-$[lambdaName]-$[metricName]-alarm\nprefixTemplate: $[stackName]\n```\n\n[FilterAndPatternSyntax]: https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/FilterAndPatternSyntax.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flironer%2Fserverless-aws-alarms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flironer%2Fserverless-aws-alarms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flironer%2Fserverless-aws-alarms/lists"}