Salta al contenuto

Generate Cost Explorer Saved Reports with API

0

Hi!

On the AWS console it's possible to generate one report and save it.

https://docs.aws.amazon.com/cost-management/latest/userguide/ce-custom-reports.html#:~:text=To%20save%20a%20Cost%20Explorer,settings%20to%20your%20default%20settings.

But I can't find the equivalent in the AWS API (I'm using python with Boto3).

I see a lot of examples of fetch cost explorer data with get_cost_and_usage but I don't find any reference to "Cost Explorer Saved Reports"

There is any way of generate custom reports and save it, programmatically?

posta 2 anni fa1,2K visualizzazioni
3 Risposte
2
Risposta accettata

Hello,

I have tried the Scenario I can only see the option to Delete or Duplicate the Saved report and there is only option to download CSV file. I think this is not your solution. I saw that we can achieve that from CLI. So, Once try that you can do more customize there.

For more information refer this:- https://docs.aws.amazon.com/cost-management/latest/userguide/ce-custom-reports.html

ESPERTO
con risposta 2 anni fa
ESPERTO
verificato 2 anni fa
ESPERTO
verificato 2 anni fa
ESPERTO
verificato 2 anni fa
0

Generate and Download Reports: Use get_cost_and_usage in Boto3 to retrieve cost data based on your desired filters and timeframe.

Process and format the retrieved data as needed for your report (e.g., tables, charts).

Utilize libraries like pandas or csv to save the formatted data in your preferred format (CSV, Excel, etc.).

Schedule Report Generation: Combine the data retrieval and formatting steps from method 1 with a scheduler like AWS Lambda or CloudWatch Events.

Set up the scheduler to run your script periodically (daily, weekly, etc.).

The script retrieves data, formats it, and saves the report to a designated location (S3 bucket, CloudWatch Logs, etc.).

Here are some resources to get you started:

Boto3 Cost Explorer API reference: https://boto3.amazonaws.com/v1/documentation/api/latest/index.html

Pandas library:https://pandas.pydata.org/

AWS Lambda: https://aws.amazon.com/lambda/

CloudWatch Events:https://docs.aws.amazon.com/cloudwatch/

ESPERTO
con risposta 2 anni fa
ESPERTO
verificato 2 anni fa
ESPERTO
verificato 2 anni fa
ESPERTO
verificato 2 anni fa
  • That's not answer the question. I already know how use get_cost_and_usage, the question is how save the report at "Cost Explorer Saved Reports".

0

I understand what you mean Carlos. You want to create reports and save them in the Cost Explorer Saved Reports. That way you can display them in the Cost Explorer dashboard.

I have a similar use case to do right now. I'm really interested in what the outcome will be.

I am not entirely sure if there's a specific post or put API for these dashboards. I could be mistaken though.

con risposta un anno fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.