Skip to content
Notifications
Clear all

Am I the only one who prefers writing my own checks in Python?

2 Posts
2 Users
0 Reactions
6 Views
(@cloud_cost_hawk_2)
Reputable Member
Joined: 3 months ago
Posts: 129
Topic starter   [#2201]

Am I a relic in a world of SaaS dashboards and AI-powered anomaly detectors? Seriously, I see a new "Cloud Cost Intelligence" platform pop up every week, promising to decode my bill with a single click. My team (mid-sized FinOps crew managing a hybrid AWS/GCP estate for about 50 product teams) keeps evaluating them. They have pretty graphs. They send alerts. And yet, I keep retreating to my trusty Python interpreter and the raw Cost and Usage Reports.

Why? Because the devil is in the *specifics*, and no generic platform can understand the bizarre, bespoke nonsense our engineering teams cook up. A platform might flag a spike in "AmazonEC2" costs. Cool. My script can tell me it's because Team Gamma's new batch job is, for some reason, spinning up `c6gd.16xlarge` instances in `us-west-2` for 47 minutes every Tuesday at 3 AM, and they're using only 2% CPU. A platform sees "S3 cost increase." My script can pinpoint it to a specific bucket, tied to a specific IAM role, that's suddenly getting 800,000 `LIST` operations per hour from a misconfigured Lambda in a dev account.

We considered self-hosted options like OpenCost, but even that felt like fitting a square peg into our weirdly shaped hole. The overhead of managing it just to get *another* layer of abstraction over the raw data? No thanks.

So, here's my stack: Boto3 and the GCP Python client, Pandas for the heavy lifting, a cron job pulling the CUR into a (cheap) Athena table, and a bunch of janky-but-beautiful scripts that do exactly what I need. For example, my simple "idle reservation finder":

```python
import pandas as pd
import boto3

def find_idle_ris(region='us-east-1'):
ce = boto3.client('ce')
ec2 = boto3.client('ec2', region_name=region)

# Get RI inventory
ris = ec2.describe_reserved_instances(Filters=[{'Name':'state','Values':['active']}])

# Get usage in the same AZ/instance family
# ... (CE query logic here) ...

# Cross-reference, find unused capacity
for ri in ris['ReservedInstances']:
if ri['InstanceCount'] > utilized_count:
print(f"WASTED RI: {ri['ReservedInstancesId']} - {ri['InstanceCount'] - utilized_count} instances idle.")
```

It's not pretty, but it's *mine*. It accounts for our specific tagging chaos, our negotiated discounts, and the three legacy accounts that still use m3.mediums.

Does anyone else get this, or am I just a grumpy old hawk screaming at the clouds (the billable ones)? The allure of a pre-built dashboard is strong, but the precision of a custom script is what actually moves the needle. Your cloud bill is too high, and maybe you're trusting a shiny tool too much to find out why.



   
Quote
(@sre_journey)
Active Member
Joined: 1 month ago
Posts: 13
 

You're not a relic, you're pragmatic. That specificity you're describing is everything for accountability. I've seen those platforms create more work because their high-level "S3 is up!" alert just starts a week-long investigation. Meanwhile, a script I wrote years ago that tags cost by Git commit hash (when deployment tooling tags resources properly) still cuts through the noise instantly.

The caveat I've hit is that my custom checks become a single point of failure. I've been bitten when a Cost and Usage Report schema changed and my script silently stopped catching a certain edge case for months. Now I pair my custom Python logic with a stupidly simple, platform-agnostic daily total cost check as a canary. If the delta between my script's sum and the provider's dashboard total grows, I know my logic is out of sync.

Do you version and test your scripts like application code, or is it more of a living, duct-tape masterpiece? 😄


@sre_journey


   
ReplyQuote