getwilds / sixtyfour

🚚 CEO, entrepreneur
https://getwilds.org/sixtyfour/
Other
11 stars 2 forks source link

Billing: handle `RECORD_TYPE` via filter or group_by #72

Closed ateucher closed 3 weeks ago

ateucher commented 2 months ago

Love where this package is going, so nice to see a "humane" approach to interacting with AWS!

I am using the billing functions, which to this point I have been rolling for myself. The aws_billing() is great for its simplicity, and I wonder if it can be more generalizable.

My specific use-case is that in our current account, all of our usage is paid for by credits as the usage occurs. By default, the cost explorer API returns net costs by time period aggregated over all charge types, so our net daily cost comes out as zero (== usage - credits). I can deal with this in two ways - add a GroupBy parameter so it groups by RECORD_TYPE (list(Type = "DIMENSION", Key = "RECORD_TYPE")), and then I can filter locally to just get usage records. Or I can add a Filter statement to the CE query to just get RECORD_TYPE == "Usage", which is what I am currently doing.

Apparently only two values for GroupBy are allowed, and since GroupBy already has two values in billing_factory(), I wonder if allowing a user to pass a filter in through aws_billing() to aws_billing_raw() would be desirable? It actually looks like the plumbing was started as there is an unused filter argument already there.

I'd be happy to start a PR if this would be of interest?

(PS Hey @sckott 👋! And @seankross - hopefully you don't start to regret asking me to kick the tires! 😉)

sckott commented 2 months ago

Thanks for kicking the tires Andy! (👋🏽 , talked to Stef and Sam at posit conf, missed seeing you)

Yeah, please submit a PR and we'll talk about it. I imagine @seankross does have a vision for the billing interface, so do chime in Sean if you have a feeling on this