https://github.com/dtan4/ec2-event-slack-notifier
AWS Lambda function / Docker image to notify EC2 Scheduled Events to Slack
https://github.com/dtan4/ec2-event-slack-notifier
ec2 ec2-scheduled-events lambda serverless slack
Last synced: about 1 year ago
JSON representation
AWS Lambda function / Docker image to notify EC2 Scheduled Events to Slack
- Host: GitHub
- URL: https://github.com/dtan4/ec2-event-slack-notifier
- Owner: dtan4
- License: mit
- Archived: true
- Created: 2016-06-13T16:30:58.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-01-23T05:25:15.000Z (over 8 years ago)
- Last Synced: 2025-03-22T15:49:58.271Z (over 1 year ago)
- Topics: ec2, ec2-scheduled-events, lambda, serverless, slack
- Language: JavaScript
- Homepage:
- Size: 151 KB
- Stars: 10
- Watchers: 1
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# EC2 Event Slack Notifier
[](https://travis-ci.org/dtan4/ec2-event-slack-notifier)
AWS Lambda function / Docker image to notify [EC2 Scheduled Events](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/monitoring-instances-status-check_sched.html) to Slack

You can install this function as...
- [Serverless](https://serverless.com/) function
- a part of [Apex](http://apex.run/) project
- standalone function
- Kubernetes CronJob
## Usage
### Environment variables
|key|description|
|---|-----------|
|`AWS_ACCESS_KEY_ID`|AWS access key ID|
|`AWS_SECRET_ACCESS_KEY`|AWS secret access key|
|`AWS_REGION`|AWS region|
|`WEBHOOK_URL`|Slack webhook URL|
|`TZ`|timezone ([tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) zone name) e.g., `Asia/Tokyo`|
### 1. Serverless function
```sh-session
$ git clone https://github.com/dtan4/ec2-event-slack-notifier.git
$ cd ec2-event-slack-notifier
$ yarn
$ cp serverless.yml.example serverless.yml
$ vim serverless.yml
$ npm run deploy
```
### 2. Apex project
Add ec2-event-slack-notifier to your Apex project:
```bash
$ git submodule add https://github.com/dtan4/ec2-event-slack-notifier.git functions/ec2-event-slack-notifier
```
Deploy it:
```bash
$ apex deploy ec2-event-slack-notifier
```
### 3. Standalone
Preparing... :construction_worker:
### 4. Kubernetes CronJob
Set these Secrets:
|name|key|description|
|----|---|-----------|
|`dotenv`|`AWS_ACCESS_KEY_ID`|AWS access key ID|
|`dotenv`|`AWS_SECRET_ACCESS_KEY`|AWS secret access key|
|`dotenv`|`AWS_REGION`|AWS region|
|`dotenv`|`WEBHOOK_URL`|Slack webhook URL|
|`dotenv`|`TZ`|timezone ([tz database](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) zone name) e.g., `Asia/Tokyo`|
deploy CronJob resource:
```bash
kubectl create -f kubernetes/cronjob.yaml [-n NAMESPACE]
```
`ec2-event-slack-notifier` Job will be invoked at 0:30 GMT in default.
## Author
Daisuke Fujita (@dtan4)
## License
[](LICENSE)