Table: aws_cost_forecast_monthly - Query AWS Cost Explorer Cost Forecast using SQL
The AWS Cost Explorer Cost Forecast is a feature of AWS that provides you with the ability to forecast your AWS costs. It uses your historical cost data to predict future expenses, enabling you to manage your budget more effectively. The forecasts are generated using machine learning algorithms and can be customized for different time periods, services, and tags.
Table Usage Guide
The aws_cost_forecast_monthly
table in Steampipe provides you with information about your monthly cost forecasts within AWS Cost Explorer. This table allows you, as a financial analyst or cloud cost manager, to query cost forecast details, including predicted costs, end and start dates, and associated metadata. You can utilize this table to gather insights on your future costs, such as predicted expenses for the next month, verification of cost trends, and more. The schema outlines the various attributes of your cost forecast, including the time period, value, and forecast results by time.
Amazon Cost Explorer helps you visualize, understand, and manage your AWS costs and usage. The aws_cost_forecast_monthly
table retrieves a forecast for how much Amazon Web Services predicts that you will spend each month over the next 12 months, based on your past costs.
Important Notes
- The pricing for the Cost Explorer API is per API request - Each request you make will incur a cost of $0.01.
Examples
Basic info
Assess the elements within your AWS cost forecast on a monthly basis to better understand your spending trends and budget accordingly. This query allows you to analyze your cost data over time, helping you to identify potential cost-saving opportunities and manage your AWS resources more effectively.
select period_start, period_end, mean_value :: numeric :: moneyfrom aws_cost_forecast_monthlyorder by period_start;
select period_start, period_end, cast(mean_value as real) as mean_valuefrom aws_cost_forecast_monthlyorder by period_start;
Month on month forecasted growth
Gain insights into the monthly growth forecast by comparing the current month's mean value with the previous month's. This allows for a clear understanding of the growth percentage change, which can aid in future planning and budgeting.
with cost_data as ( select period_start, mean_value as this_month, lag(mean_value, -1) over( order by period_start desc ) as previous_month from aws_cost_forecast_monthly)select period_start, this_month :: numeric :: money, previous_month :: numeric :: money, case when previous_month = 0 and this_month = 0 then 0 when previous_month = 0 then 999 else round( (100 * ((this_month - previous_month) / previous_month)) :: numeric, 2 ) end as percent_changefrom cost_dataorder by period_start;
with cost_data as ( select period_start, mean_value as this_month, lag(mean_value, -1) over( order by period_start desc ) as previous_month from aws_cost_forecast_monthly)select period_start, this_month, previous_month, case when previous_month = 0 and this_month = 0 then 0 when previous_month = 0 then 999 else round( (100 * ((this_month - previous_month) / previous_month)), 2 ) end as percent_changefrom cost_dataorder by period_start;
Schema for aws_cost_forecast_monthly
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
mean_value | double precision | Average forecasted value | |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
period_end | timestamp with time zone | End timestamp for this cost metric | |
period_start | timestamp with time zone | Start timestamp for this cost metric | |
region | text | The AWS Region in which the resource is located. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- aws
You can pass the configuration to the command with the --config
argument:
steampipe_export_aws --config '<your_config>' aws_cost_forecast_monthly