ucsc-cgp / cloud-billing-report

Generates a summary billing report for various UCSC-CGP cloud accounts.
5 stars 4 forks source link

The Great Refactor #65

Closed Richard-Hansen closed 2 years ago

Richard-Hansen commented 2 years ago

In prep for handling more GCP compliance, I wanted to re-write the entire billing report so that it would be more maintainable. Amongst other things, this PR includes:

  1. Stronger OOP approach. Python typing is the worst, so 'stronger' is an iffy word here.
  2. Less logic in jinja HTML files. Exclusively using summation where needed, no filtering/grouping/parsing/conditionals in the html anymore.
  3. No more printing the primary email file to stdout, while having individual emails created as files. All emails are written as files to the same output directory.
  4. Service by resource summary for the most expensive resources. That way we can get a better idea of what we are actually spending on S3/EC2 and the like.
  5. Only managed AWS accounts appear in the extra analysis tables of the AWS billing email.
  6. Resources are queried based on tag, and tag alone, regardless of if they are managed resources. This means individuals will be seeing more emails in their personal report if they have bunches of resources tagged (managed + unmanaged). We will also see unmanaged resources that are costing us an arm and a leg for better accounting.
Richard-Hansen commented 2 years ago

Although this provides development QoL, this original approach is still more efficient. Closing.