• Stars
    star
    222
  • Rank 179,123 (Top 4 %)
  • Language
    Python
  • License
    MIT License
  • Created about 5 years ago
  • Updated 5 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Send a daily AWS cost report to a Slack channel of your choice.

AWS Billing to Slack

image

Sends daily breakdowns of AWS costs to a Slack channel.

Install

  1. Install serverless, which I use to configure the AWS Lambda function that runs daily.

    npm install -g serverless
    
  2. Create an incoming webhook that will post to the channel of your choice on your Slack workspace. Grab the URL for use in the next step.

  3. Create the service on your local machine. cd to your directory and run this command. Replace path with the path name for the service and app name for the service.

    serverless create \
      --template-url="https://github.com/iandees/aws-billing-to-slack.git" \
      --path="app-aws-cost" \
      --name="app-aws-cost"
    
  4. Install pipenv

    pip install pipenv==2023.7.4
    
  5. Install serverless python requirements

    serverless plugin install -n serverless-python-requirements
    
  6. Deploy the system into your AWS account, replacing the webhook URL below with the one you generated above.

    serverless deploy --stage="prod" --param="slack_url=https://hooks.slack.com/services/xxx/yyy/zzzz"
    

    You can also run it once to verify that it works:

    serverless invoke --function report_cost --stage="prod" --param="slack_url=https://hooks.slack.com/services/xxx/yyy/zzzz"
    

Support for AWS Credits

If you have AWS credits on your account and want to see them taken into account on this report, head to your billing dashboard and note down the "Expiration Date", "Amount Remaining", and the "as of" date towards the bottom of the page. Add all three of these items to the command line when executing the deploy or invoke:

```
serverless deploy \
    --param "slack_url=https://hooks.slack.com/services/xxx/yyy/zzzz" \
    --param "credits_expire_date=mm/dd/yyyy" \
    --param "credits_remaining_date=mm/dd/yyyy" \
    --param "credits_remaining=xxx.xx"
```

Support for other Dimensions

If you have and AWS Organisation established and would like to see a breakdown by account, you can override the default dimensions with parameters:

```
serverless deploy \
    --param "slack_url=https://hooks.slack.com/services/xxx/yyy/zzzz" \
    --param "group=LINKED_ACCOUNT" \
    --param "group_length=15"
```

Possible value for group are:

  • AZ
  • INSTANCE_TYPE
  • LINKED_ACCOUNT
  • OPERATION
  • PURCHASE_TYPE
  • SERVICE
  • USAGE_TYPE
  • PLATFORM
  • TENANCY
  • RECORD_TYPE
  • LEGAL_ENTITY_NAME
  • INVOICING_ENTITY
  • DEPLOYMENT_OPTION
  • DATABASE_ENGINE
  • CACHE_ENGINE
  • INSTANCE_TYPE_FAMILY
  • REGION, BILLING_ENTITY
  • RESERVATION_ID
  • SAVINGS_PLANS_TYPE
  • SAVINGS_PLAN_ARN
  • OPERATING_SYSTEM

Other Useful CLI Arguments Related to your AWS account

By default, AWS_PROFILE and AWS_REGION are defaulting to default and us-east-1. These value can be changed by modifying the environment. For aws account, sensible default is attempted to be retrieved. For example, boto3 is used to try and determine your AWS account alias if it exists, and if not your AWS account ID. Additionally, for your AWS region the environment variables AWS_REGION, then AWS_DEFAULT_REGION are read and used if present, otherwise fallback to 'us-east-1' (N. Virginia).

```
AWS_PROFILE="default" AWS_REGION="eu-west-1" serverless deploy \
    --param "slack_url=https://hooks.slack.com/services/xxx/yyy/zzzz" \
    --param "aws_account=my custom account name"
```

Support for different cost aggretations

By default we show the unblended costs, but if you set the environment variable COST_AGGREGATION to something else, you can change the cost aggretation AWS uses. Possible values are: AmortizedCost, BlendedCost, NetAmortizedCost, NetUnblendedCost, NormalizedUsageAmount, UnblendedCost, and UsageQuantity. More information is available at the Metrics request parameter here

Authors

More Repositories

1

wtf-zipcodes

So you want to map zipcodes...
81
star
2

mongosm

An OpenStreetMap importer/map-call for MongoDB
Python
71
star
3

speedtrack

Python + OpenCV tool to count cars on the road in front of my house.
Python
63
star
4

shp-to-osm

Shapefile to OSM convertor
Java
37
star
5

social_scrapers

Various Python scripts to scrape sites that store data about you.
Python
27
star
6

xapi-servlet

XAPI Servlet
Java
27
star
7

planet-gpx-dump

Tool to dump all GPS traces collected by/for the OpenStreetMap project.
Python
26
star
8

image-to-osm

Use an LLM to suggest tags based on an image you capture with your phone.
HTML
26
star
9

usps-collection-boxes

US Postal Service collection box locations.
Python
23
star
10

divvyapiapi

An API for the Divvy bike share API.
HTML
20
star
11

detect-baseball-diamonds

Various attempts at scanning aerial imagery to detect baseball diamonds.
Python
17
star
12

pyosm

A Python library for parsing OSM streams.
Python
15
star
13

divvy-dump

Dump your Divvy bike rides to a CSV file.
Python
12
star
14

josm-mbtiles

A JOSM plugin that shows mbtiles files as a background layer.
Java
11
star
15

bucket-protection

A simple app to add OAuth-based authentication in front of an S3 bucket-based static website.
Python
11
star
16

supybot-plugin-osm

An OSM plugin for Supybot.
Python
10
star
17

uk-lidar

Easier downloading of UK LIDAR data
Shell
10
star
18

planet-notes-dump

A utility to dump OpenStreetMap notes from the database into an XML file for bulk use.
Python
10
star
19

josm-geojson

Moved to
Java
9
star
20

geo-conferences

A repository of past, present, and future geo-related conferences and events.
7
star
21

building-diff

Use turf.js to find areas where there are Microsoft computer-detected buildings but no OSM buildings.
JavaScript
7
star
22

on-every-corner

Find road intersections (aka taco truck locations) in OSM data.
JavaScript
6
star
23

poism-py

A simple web app that allows editing and adding points of interest in OpenStreetMap.
Python
6
star
24

national-bridge-inventory

A Python parser for the National Bridge Inventory
Makefile
6
star
25

slackosm

Tools for interacting with OSM in Slack.
Python
5
star
26

warc-to-s3

Put a web archive (WARC) on an S3 bucket suitable for hosting with S3 Website Hosting.
Go
5
star
27

tiger-battlegrid

A reimplementation of the TIGER / OSM "Battlegrid" map using tile-reduce.
JavaScript
4
star
28

cook_county_pin_scraper

Scrapes the Cook County assessor's office PIN page and dumps data in a more useful format.
Python
4
star
29

osm-stream-process

A simple Python script to make it easier to parse the minutely diff stream and perform tasks in near realtime.
Python
4
star
30

magicshop-josm

A JOSM plugin for Bing's Magicshop API.
Java
4
star
31

android-osm-nearby

A simple OSM POI editor for Android.
Java
4
star
32

imageservice-to-mbtiles

Scrape an Esri image service and output an mbtiles file of the tiles.
Go
4
star
33

recipes

Collaborative recipes collection inspired by sinker/tacofancy.
4
star
34

osm2mysql

Experiments in loading OSM data in to MySQL (specifically Amazon's RDS).
Python
4
star
35

geojson-api

A Node server that periodically loads a GeoJSON file with points in it and exposes an API to find the nearest points from a lat/lon.
JavaScript
4
star
36

netgear-scrapers

Scrapers to pull status data from Netgear R7000 routers and CM1000 cable modems and push them into InfluxDB.
Python
4
star
37

tiger-tiles

Processing code to prepare TIGER data for usage as an overlay to assist OpenStreetMap editors.
Python
3
star
38

pyxapi

Python implementation of a XAPI for OpenStreetMap.
Python
3
star
39

shapefile-split

A simple python script to split a shapefile into smaller pieces.
Python
3
star
40

xapi-ui

An HTML based interface to OpenStreetMap's XAPI
JavaScript
3
star
41

josm-notes

A JOSM plugin to show OpenStreetMap Notes.
Java
3
star
42

osm-on-ec2

Scripts to set up and maintain OSM data on Amazon's EC2.
Shell
3
star
43

mx-lidar

Scripts to simplify the process of downloading Mexico's LIDAR-based DEM data.
Python
3
star
44

android-cam-test

First attempt at an Android app
Java
3
star
45

csv-to-qbo

Converts CSV exports from Paypal to a CSV format that QuickBooks Online understands.
Python
3
star
46

drawabox

A simple App Engine app that allows a website to request the user to draw a bounding box and receive the bounding box in a callback URL.
JavaScript
3
star
47

osm-to-mongo

OSM importer for MongoDB
Java
3
star
48

xapi-antlr

An XAPI querystring parser using Antlr.
Java
2
star
49

sqlite2ormlite

Generate ORMlite-based Java code based on a SQLite database file.
Python
2
star
50

bike-hire-map

A visualization of cycle-hire data.
JavaScript
2
star
51

esri-proxy

Python
2
star
52

wof-editor

A simple Who's on First editor.
HTML
2
star
53

android-download-manager-backport

A back port of the Gingerbread DownloadManager code that should run on 2.1+.
2
star
54

countdown-tweeter

Periodically tweet the amount of time left to a particular time in the future.
Python
2
star
55

osm-weirdness

Watch OSM minutely diffs to look for odd-looking changes.
Python
2
star
56

waydetails

A JOSM plugin that lets you reorder and delete nodes referenced by a way.
Java
2
star
57

osm-changes

Tools to help understand changes to OpenStreetMap.
Python
2
star
58

acs2sqlite

Convert American Community Survey releases into SQLite databases for easier distribution.
Python
2
star
59

loco

Share your location with your team.
Python
2
star
60

slack-stale-channels

A simple script to archive idle/quiet channels in Slack.
Python
2
star
61

divvy-data

A script to grab Divvy station data at a regular interval and save it to a CSV.
Python
2
star
62

osmf-logovote

The source code for the OSMF logo vote.
PHP
1
star
63

membership

A simple Flask application to help keep track of an organizations membership list.
JavaScript
1
star
64

josm-shapefile

JOSM plugin to load ESRI Shapefiles.
Java
1
star
65

whereandwhen

A simple API for events that have a place and a time.
JavaScript
1
star
66

osm-api

OSM base classes for shp-to-osm.
Java
1
star
67

sanborn-illinois-scraper

Retrieve Sanborn maps from the CPL.
Python
1
star
68

gogr2osm

Go
1
star
69

mbtiles2dir

Simple script that dumps the contents of an mbtiles file to a directory.
Python
1
star
70

editor-ignore-tags

A canonical list of OpenStreetMap tags to ignore.
1
star
71

osmc-fusiontables

Reads OSM diffs and inserts into Fusion Tables for visualization.
Python
1
star
72

metraapi

A Python library that makes it easy to find realtime arrival times for the Chicago Metra.
Python
1
star
73

deep-history-py

Python version of the Mapki OSM Deep History viewer.
HTML
1
star
74

glomifier

Groups OSM ways together based on a tag.
Java
1
star
75

cal-map

A script to generate a GeoJSON file of an aggregated list of events.
Python
1
star
76

git2bugzilla

A python script to read git commits on a repo, scanning for bug numbers and posting to Bugzilla.
Python
1
star
77

va-ethics-scraper

Scraper for Virginia Conflict of Interest and Ethics Advisory Council website.
Python
1
star
78

microdata2osm

Extracts microdata from websites and outputs OSM tags.
Python
1
star
79

googio-lastchange-geo

Google I/O 2011 Last Change Geo Project
JavaScript
1
star