How can I correlate a EC2 TAG with machine usage?

I’m looking for a way to create an Insights dashboard that shows me COST of running machines with a given tag, and then next to it, another chart that shows the actual USAGE of those machines.

We have a process by which we allow some analysts to spin up EC2 instances to work with ‘point in time’ data sets, however I’m not convinced we’re getting the bang for the buck from these.

I’d like to go back to the DATA and say: “Look, last month you started 15 instances, costing an estimate of $4500 in cost, but the average CPU of these machines was almost negligible. Do you really need to spin these up?”

What I have tried thus far:

SELECT * from ComputeSample WHERE provider = ‘Ec2Instance’ limit 5

then inspect this to find anything that looks like a key that can be used to join against the machine information.

SELECT * from FinanceSample where provider=‘BillingServiceCost’ AND providerAccountId = ‘4515’ since 1 day ago limit 5

What I find in both of these results is an ‘entityGuid’, which definitely looks promising…

Then to pull CPU information:
“SELECT average(cpuPercent) FROM SystemSample TIMESERIES FACET entityId WHERE (entityId in (‘8864794503722940700’, ‘6415259491618633100’, ‘2973353937161916645’, ‘9211868280489576279’, ‘1085041849122858892’)) LIMIT 100 SINCE 60 minutes ago”

and in here, I also note that there is a Gguid that I can filter with.

I’ve gone through the items listed at Useful Insights NRQL queries library to no avail.

Is what I’m trying to do (a join across FinanceSample, ComputeSample, and SystemSample) possible?

Are you using any custom tags? Do you see any tags named “ec2Tag_TAG_NAME”?

1 Like

Yes, in SystemSample, there is a ec2Tag_Mode (which is the tag I want to report against)

so, if I understand correctly, I could use the first column to pick which tag to filter on, then use that as a FACET, to trigger the filtering in a second chart which would show billing information?

I think that I’m too used to wanting to include my own joins in my queries – whereas Insights is automatically adding these filters based on my selections perhaps?

Were it left up to me, I’d probably be envisioning doing something like
SystemSample.ec2Tag_Mode=VALUE AND SystemSample.entityGuid=FinanceSample.entityGuid AND FinanceSample.provider=‘BillingServiceCost’

and from that I would have a “join” that would combine these data points into a single unified result.

Thanks for your reply, 6MM ! :smiley:

1 Like

If you have the custom tags you should be able to filter on them.

SELECT average(cpuPercent) FROM SystemSample where ec2Tag_Mode=VALUE FACET entityId TIMESERIES MAX LIMIT 100 SINCE 60 minutes ago

Tag that job/app/system/whatever in AWS with a custom tag so you can filter on it.

Hey @bill.mitchell let us know if you have further questions after @6MM’s latest query :slight_smile: