cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Empty resource_id when querying the Bill Analysis API

Hello, 

I'm running into a small problem when querying the Bill Analysis costs/select end point. I'm specifying the `resource_id` as a dimension to be returned but when looking at the data received from the endpoint, the `resource_id` for each item in the `rows` array is an empty string ( "" ). Is there some request parameter that I need to include to have this value returned? Any help would be much appreciated.

 

Thanks in advance!

Ryan 

(14) Replies
Hi Ryan

You can find the dimensions available using the get cost/dimension api call found here
https://reference.rightscale.com/bill_analysis/?url=swagger_adj.json#/costs/costs_dimensions

Let me know if that helps.

Hi egonzalez, 

Ok, so that certainly explains why including the `resource_id` to the dimensions didn't produce the result that it used to. It looks like that's no longer a valid dimension.  So previously `resource_id` used to, for AWS EC2 instances, provide an id for a given instance. It looked something like: 

EC2 Instance: i-[\w\d]{17} # which basically "i-" followed by 17 letters and / or numbers

EC2 Volume: vol-[\w\d]{17} # "vol-" followed by 17 letters and / or numbers

Would you happen to know where else I could access this information? 

 

Thanks!

Ryan 

Hello, 

Just wanted to touch bases and see if any progress had been made on whether or not it was still possible to get the information contained in the  previously available "resource_id" dimension via some other mechanism or API?

Thanks in advance!

Ryan

Hi @egonzalez ,

Not sure if I was doing the replies right or not, but I wanted to reach out and see if the information that was previously provided by the `resource_id` dimension is available in some other way? 

Thanks!

Ryan 

 

Hi Ryan

 

Are you trying to retrieve the cost for a specific resource ?  Please let me know what you are trying to accomplish and I'll be able to better guide you in retrieving the data or use an existing feature.

 

Thanks 

Hi @egonzalez ,

Ultimately we're trying to retrieve the amount of time that a specific resource has run. Eventually we'll be concerned with how much was charged for a particular resource, but for now we're just looking at getting just the up time for AWS EC2 instances. 

 

Thanks,

 

Ryan 

Hi Ryan

Are you familiar with the Flexera Policy Engine ? You may have learned about it during discussing additional cost savings opportunities. 

Policy Engine

https://docs.rightscale.com/policies/

We have a policy that provides the data you mentioned, also provides a nice report and the ability to eventually apply an action (stop/terminate) . It reports backs on instances that have been running X number of days.

https://github.com/flexera/policy_templates/tree/master/operational/aws/long_running_instances/

Let me know if this helps. 

 

 

Hi @egonzalez ,

 

Thanks so much for the additional information. It definitely looks like we would have access to the information we're looking for in a Policy Template, the last bit that I'm trying to figure out is how we could export / receive that information when the policy is run. Ideally we'd like to receive a json file daily that has information about each amazon EC2 instance run / running / stopped etc. that day. I see that we can trigger an email and have that email populated via a template, are there other methods of exporting information? 

Thanks!

Ryan

Hi Ryan

We have an api that allows you to manage policies and retrieve incident information for each policy.

https://reference.rightscale.com/governance-policies/

I recommend you run it manually, confirm you're getting the required data, then look into polling for incidents via the api.

Depending on the client you're using you might be able to integrate it directly with the API to generate the json it expects. How are you planning to use the data once you have it available?

 

Hope that helps.

 

 

Hi @egonzalez ,

This certainly looks promising, quick question, are policies available in Optima? I ask because at the moment Optima is all I have access to. 

Thanks again!

Ryan 

@CCRDev 

The cost management policies as well as the Policy Engine are included with Optima.

Thanks,

Hi @JohnSorensenDK ,

Fantastic! I'll start digging in to Policy Templates then. 

Thanks again!

This has me thinking it'd be nice to do a virtual meet-up where @cwilhelm  could walk through the most popular policies (he's well-versed and could share some of the exciting new ones.) @CCRDev - would y'all be interested in attending? If so, I'll get some wheels moving. 

If you appreciate my efforts, please give me a kudo
Accept as solution to help others find it faster.

Hi @KPBussey ,

That sounds like it could be really beneficial, I would definitely be interested. 

Thanks!