/notify_aws_cost

AWSのコストを通知するやつ

Primary LanguageRuby

NotifyAwsCost

当月の前日までのAWS利用料金をslackに通知します

Installation

Add this line to your application's Gemfile:

gem 'notify_aws_cost', git: 'https://github.com/higeojisan/notify_aws_cost.git'

And then execute:

$ bundle

Usage

Prerequisite

export SLACK_WEBHOOK_URL='......'
export AWS_ACCESS_KEY_ID='.......'
export AWS_SECRET_ACCESS_KEY='.....'
export AWS_REGION='us-east-1'

Sample(1)

require 'notify_aws_cost'

notify = NotifyAwsCost::Notify.new
notify.send

Sample(1)

Sample(2)

cutomize name and icon

require 'notify_aws_cost'

notify = NotifyAwsCost::Notify.new({name: "higeojisan", icon_emoji: ":smile:"})
notify.send

Sample(2)

Sample(3)

set warning and critical threshold or either of them

require 'notify_aws_cost'

notify = NotifyAwsCost::Notify.new({warning: 2, critical: 3})
notify.send
  • If cost is less than warning, color is green Sample(3-1)

  • If cost is more than waring and less than critical, color is yellow Sample(3-2)

  • If cost is more than critical, color is red Sample(3-3)