This bot is implemented in golang and is meant to send AWS Usage report to an integrated slack channel. The following services are watched and reported:
- EC2 Usage.
- S3 Usage.
- CloudFront Usage.
- RDS Usage.
- Elasticache Usage.
- Estimated Billing.
You can specify any region(s) you want to watch and the frequency of reporting using cron definition
The application is release via Docker
, which can be found here: https://hub.docker.com/r/wumuxian/aws-slack-bot/
Choose a version to use, currently the latest version is wumuxian/aws-slack-bot:v0.0.2
You need to set the following parameters to make it work.
Environment Variables | Decription |
---|---|
AWS_ACCESS_KEY_ID | You access key ID to the AWS account |
AWS_SECRET_ACCESS_KEY | You access secret to the AWS account |
AWS_ACCOUNT_ID | The AWS account ID you want to watch |
SLACK_WEBHOOK_URL | The slack channel web-hook |
CRON_DEFINITION | The cron job definition that sets the frequency of the report |
REGIONS | Comma separated regions you want to watch, e.g. us-east-1,eu-central-1 |
Notes: Please note that your IAM must be granted relevant read access to the services. If not then you won't receive report for that service.
If you don't specify the CRON_DEFINITION
, the default will be 0 0 1 * * MON-FRI
, which means "Every 9am in the morning, from Monday to Friday, SGT Timezone"
If you don't specify the REGIONS
, the default will be us-east-1
, which is US East (N. Virginia)
The SLACK_WEBHOOK_URL
is a required field, if not specified, the program won't run.
The CRON_DEFINITION
must have correct cron syntax, otherwise the program won't run.
Example execution script using docker:
docker run -d \
-e AWS_ACCESS_KEY_ID="" \
-e AWS_SECRET_ACCESS_KEY="" \
-e AWS_ACCOUNT_ID = "" \
-e SLACK_WEBHOOK_URL="" \
-e CRON_DEFINITION="0/5 * * * * ?" \
-e REGIONS="us-east-1,ap-southeast-1" \
--name aws-slack-bot wumuxian/aws-slack-bot:v0.0.2
If you want to contribute to the repo, please continue to read.
dep init
dep ensure
go run *.go
./build.sh
Feel free to build to your own images, just modify the build.sh script.
./release.sh
Fee free to release to your own repo, just modify the release.sh script