{"id":13820342,"url":"https://github.com/arabold/aws-to-slack","last_synced_at":"2025-04-05T06:02:22.763Z","repository":{"id":23449088,"uuid":"99044287","full_name":"arabold/aws-to-slack","owner":"arabold","description":"Forward AWS CloudWatch Alarms and other notifications from Amazon SNS to Slack.","archived":false,"fork":false,"pushed_at":"2022-05-27T16:57:48.000Z","size":4612,"stargazers_count":291,"open_issues_count":16,"forks_count":113,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-03-15T11:04:56.055Z","etag":null,"topics":["amazon-lambda","amazon-sns","aws","aws-cloudwatch","aws-lambda","cloudwatch-alarm","devops","serverless","slack"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/arabold.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-08-01T21:22:32.000Z","updated_at":"2024-03-11T12:16:23.000Z","dependencies_parsed_at":"2022-08-20T11:50:40.786Z","dependency_job_id":null,"html_url":"https://github.com/arabold/aws-to-slack","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arabold%2Faws-to-slack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arabold%2Faws-to-slack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arabold%2Faws-to-slack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arabold%2Faws-to-slack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arabold","download_url":"https://codeload.github.com/arabold/aws-to-slack/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247294513,"owners_count":20915340,"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":["amazon-lambda","amazon-sns","aws","aws-cloudwatch","aws-lambda","cloudwatch-alarm","devops","serverless","slack"],"created_at":"2024-08-04T08:01:01.733Z","updated_at":"2025-04-05T06:02:22.738Z","avatar_url":"https://github.com/arabold.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# AWS-to-Slack\n\n[![npm](https://img.shields.io/npm/v/aws-to-slack.svg)](https://www.npmjs.com/package/aws-to-slack)\n[![license](https://img.shields.io/github/license/arabold/aws-to-slack.svg)](https://github.com/arabold/aws-to-slack/blob/master/LICENSE)\n[![dependencies](https://img.shields.io/david/arabold/aws-to-slack.svg)](https://www.npmjs.com/package/aws-to-slack)\n\n\nForward AWS CloudWatch Alarms and other notifications from Amazon SNS to Slack.\n\n\u003ctable\u003e\n   \u003ctr\u003e\n      \u003cth\u003eCloudWatch Example\u003c/th\u003e\n      \u003cth\u003eEB Event Example\u003c/th\u003e\n   \u003c/tr\u003e\n   \u003ctr\u003e\n      \u003ctd width=\"50%\"\u003e\u003cimg alt=\"CloudWatch Alarm Example\" src=\"./docs/alert-example-cw.png\"\u003e\u003c/td\u003e\n      \u003ctd\u003e\u003cimg alt=\"Elastic Beanstalk Example\" src=\"./docs/alert-example-eb.png\"\u003e\u003c/td\u003e\n   \u003c/tr\u003e\n\u003c/table\u003e\n\n## What is it?\n_AWS-to-Slack_ is a Lambda function written in Node.js that forwards alarms and\nnotifications to a dedicated [Slack](https://slack.com) channel. It is self-hosted\nin your own AWS environment and doesn't have any 3rd party dependencies other\nthan the Google Charts API for rendering CloudWatch metrics.\n\nSupported AWS product notification formats:\n* Auto-Scaling Events\n* Batch Events\n* CloudFormation\n* CloudWatch Alarms *(incl. Metrics!)*\n* CodeBuild\n* CodeCommit\n* CodeDeploy 🆕 _(via SNS/CloudWatch)_\n* CodePipeline 🆕 _(via SNS/CloudWatch)_\n* CodePipeline Manual Approval 🆕\n* Elastic Beanstalk\n* GuardDuty 🆕\n* Health Dashboard\n* Inspector\n* RDS\n* SES Received Notifications\n* Generic SNS messages\n* Plain text messages\n\nAdditional formats will be added. Pull Requests are welcome!\n\n## Try!\nReady to try the latest version for yourself? Installation into your own AWS environment is simple:\n\n### Option 1: Quick Start (OLD CODE)\n\n[![Launch CloudFormation Stack](https://s3.amazonaws.com/cloudformation-examples/cloudformation-launch-stack.png)](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=aws-to-slack)\n\n*Warning!* The template referenced by this link is an old template and old code! If you want the latest version of this repo, you need to update the Lambda code after it's launched.\n      \n### Option 2: Get the latest bug fixes\n\n1. Download this repo locally.\n\n1. Use AWS Console's [Create CloudFormation Stack](https://console.aws.amazon.com/cloudformation/home?region=us-east-1#/stacks/new?stackName=aws-to-slack) tool.\n\n   Upload [cloudformation.yaml](https://raw.githubusercontent.com/arabold/aws-to-slack/master/cloudformation.yaml) as your template.\n\n1. Finish launching the Stack.\n\n   For details on the parameter values, see [Installation](#installation) section. \n\n1. Build / Update the code by running the following from the root of this project:\n   ```\n   AWS_REGION=\"\u003cyour_lambda_region\u003e\" LAMBDA_NAME=\"\u003cyour_lambda_name\u003e\" make deploy\n   ```  \n\n   If you use AWS CLI profiles, simply add `AWS_PROFILE` to the make command like so:\n   ```\n   AWS_PROFILE=\"my-profile\" AWS_REGION=\"\u003cyour_lambda_region\u003e\" LAMBDA_NAME=\"\u003cyour_lambda_name\u003e\" make deploy\n   ```\n\n### Option 3: Use deploy target\n\nSee [Managing Multiple Deployments](#managing-multiple-deployments) for a `.env` file approach to creating or managing multiple stacks.\n\n## Installation\n\n### Step 1: Setup Slack\nThe Lambda function communicates with Slack through a Slack webhook\n[webhook](https://my.slack.com/apps/manage). Note that you can either create an app, or a custom integration \u003e Incoming webhook (easier, will only let you add a webhook)\n\n1. Navigate to https://my.slack.com/apps/manage and click\n   \"Add Configuration\".\n2. Choose the default channel where messages will be sent and click\n   \"Add Incoming WebHooks Integration\".\n3. Copy the webhook URL from the setup instructions and use it in the next\n   section.\n4. Click \"Save Settings\" at the bottom of the Slack integration page.\n\n![Slack Configuration](./docs/config-slack.png)\n\n### Step 2: Configure \u0026 Launch the CloudFormation Stack\n\nNote that the AWS region will be the region from which you launch the CloudFormation wizard, which will also scope the resources (SNS, etc.) to that region. \n\nLaunch the CloudFormation Stack by using our preconfigured CloudFormation\n[template](https://raw.githubusercontent.com/arabold/aws-to-slack/master/cloudformation.yaml) and following the [steps above](#try).\n\n**Afterwards**\n\nClick \"Next\" and on the following page name your new stack and paste the\nwebhook URL from before into the \"HookUrl\" field. You can also configure a\ndifferent channel to post to if wanted.\n\n![AWS CloudFormation Configuration](./docs/config-stack.png)\n\nClick \"Next\" again, complete the stack setup on the following pages and\nfinally launch your stack.\n\n### Step 3: Subscribe to Triggers\n\nBefore the Lambda function will actually do anything you need to subscribe it\nto actual CloudWatch alarms and other SNS triggers. Open up the AWS Lambda,\nswitch to the \"Triggers\" tab and subscribe for all events you're interested in.\n\n![Lambda Triggers](./docs/config-lambda-triggers.png)\n\n\n### Setting Up AWS CodeBuild\nCodeBuild integration was suggested by [ericcj](https://github.com/ericcj) and is based on\nthe Medium post [Monitor your AWS CodeBuilds via Lambda and Slack](https://hackernoon.com/monitor-your-aws-codebuilds-via-lambda-and-slack-ae2c621f68f1) by\nRandy Findley. \n\nTo enable CodeBuild notifications add a new _CloudWatch Event Rule_, choose _CodeBuild_\nas source and _CodeBuild Build State Change_ as type. As Target select the `aws-to-slack`\nLambda. You can leave all other settings as is. Once your rule is created all CodeBuild\nbuild state events will be forwarded to your Slack channel.\n\n### Setting Up AWS CodeCommit\n\nSimilar to the CodeBuild integration, CodeCommit notifications are triggered by\nCloudWatch Event Rules. Create a new CloudWatch Event Rule, select _CodeCommit_\nas the source, and select one of the supported event types:\n\n* _CodeCommit Pull Request State Change_ - Will generate events when a pull\n  request is opened, closed, merged, or updated.\n* _CodeCommit Repository State Change_ - Will generate events when a branch\n  or tag reference is created, updated, or deleted.\n\nAdd the `aws-to-slack` lambda as the target. No other settings are needed.\n\n## Managing Multiple Deployments\n\nYou can save local `.env` files that contain your stack configurations for easier deployment and updates.  Copy `targets/example.env` to a separate file and customize the parameters.  Then deploy the file like this:\n\n```bash\nTARGET=targets/my-deploy.env make deploy\n```\n\nIf you want to force-compile this project and push your code to a stack, use this:\n```bash\nTARGET=targets/my-deploy.env make package deploy\n```\n\nIf you need to update your CloudFormation parameters, try this:\n```bash\nTARGET=targets/my-deploy.env make update-stack\n```\n\n## Contributing\n\nYou want to contribute? That's awesome! 🎉\n\nCheck out our [issues page](https://github.com/arabold/aws-to-slack/issues) for\nsome ideas how to contribute and a list of open tasks. There're plenty of\nnotification formats that still need to be supported.\n\nThe repository comes with a very simple `Makefile` to build the CloudFormation\nstack yourself. \n\n```bash\nmake package\n```\n\nThis generates a new `release.zip` in the root folder. Upload this zip to your\nAWS Lambda function and you're good to go. Make sure to check out [Managing Multiple Deployments](#managing-multiple-deployments) for a more scalable solution to deploys.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farabold%2Faws-to-slack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farabold%2Faws-to-slack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farabold%2Faws-to-slack/lists"}