Giter Site home page Giter Site logo

myazurecost's Introduction

myAzureCost...

HitCount
...sends you a daily email with your azure consumption report...
...calculates costs if you uploaded a price sheet...
...uses ARM template for setup, azure automation for daily tasks, sendgrid as 0 cost email solution and storage account to hold data.
...you build (guided) this in your subscription.

Result & Screenshots

In your inbox you'll get a report each day of the usage and the costs (if you upload a price sheet):

daily email your daily cost email looks similar to this
consumption report consumption report is attached to email
cost report some excel cosmetics on the cost report

The email contains some charts:

7days History Costs Per Region Costs Per RG Costs Per RG
cost email contains history graph. Azure table is used to hold the data. Display the costs per region. Cost per Resource Group Cost Per Category

The Setup

1. Deploy the ARM Template
2. Create an Azure Run As Account
3. Create a Table and see AA Variables Section
4. Generate a price sheet
5. Run a report

The Solution Description & Architecture

The idea of this project was to gather daily all relevant azure usage information as CSV for a reliable cost estimation | calculation. When you try, demo, PoC a scenario the usage / cost can be gathered with myAzureCost.
You don't have to wait for the end of the month. You may then do some 'excel magic' whith the obtained reports and have a solid cost estimation for your manager, customer,...
BTW you learn how azure services used work by investigating:

  • which resources are consumed
  • in which quantities. (hours, network bandwidth, read / write operations,...)

you'll know what is driving costs up and what can be neglected. This should help to optimize and save costs.
Cost can be calculated if you provide a price sheet. An example of how to generate a price sheet and what the format should look like is provided in the setup .
Azure gathers usage info of the all resources used (including ones that have 0 cost) but does not immediately provide them. It'll take time (hours, a day) until you can query them using PowerShell | REST. Therefore myAzureCost looks back and tries to summarize the usage of the previous day.
It'll use azure automation to gather data save it in a storage account (daily aggregations + price sheet) and save history cost information in an azure table. It's deployed using an ARM template you can find in the SetupArtefacts folder. You don't need to setup anything on your box - as we use the Azure Cloud Shell to kick of the deployment scripts. Emails are sent using the free plan from sendgrid (a 3rd party service).
The final architecture looks like this: Architecture

What can go wrong

no usage report - check if there is a report for the day (i.e. the previous day) on the storage account if not run the RunBk_UsageAggregates watch for errors. e.g. do you have an AA Run as account?

empty usage report - If you run the RunBk_UsageAggregates too early in the morning the report may be empty as Azure hasn't provided the usage yet. Try at a later time.

empty cost reports - Do you have a price sheet uploaded? Can you download the pricesheet with the URI (SAS token) you have generated? Is it a CSV (';' separated) in en-us (no commas but dot as decimal specifier). Does it have a MeterId and MeterRates column?

my report is not 100% accurate - Yes it is an estimation - why? because some services include free quantity which is not subtracted from the costs being calculated here.

no email - Did your sendgrid setup work? Or your sendgrid password was too easy or did it expire? Azure Portal -> rg-myAzureCost ->sgridazconsumption... -> Manage

myazurecost's People

Contributors

marcomobilab avatar bfrankms avatar joaovrodrigues avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.