AWS Lambda function / Docker image to notify EC2 Scheduled Events to Slack
You can install this function as...
- Serverless function
- a part of Apex project
- standalone function
- Kubernetes CronJob
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 zone name) e.g., Asia/Tokyo |
$ 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
Add ec2-event-slack-notifier to your Apex project:
$ git submodule add https://github.com/dtan4/ec2-event-slack-notifier.git functions/ec2-event-slack-notifier
Deploy it:
$ apex deploy ec2-event-slack-notifier
Preparing... 👷
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 zone name) e.g., Asia/Tokyo |
deploy CronJob resource:
kubectl create -f kubernetes/cronjob.yaml [-n NAMESPACE]
ec2-event-slack-notifier
Job will be invoked at 0:30 GMT in default.
Daisuke Fujita (@dtan4)