Table: aws_costoptimizationhub_recommendation - Query AWS Cost Optimization Recommendations using SQL
The AWS Cost Optimization Hub provides recommendations for reducing costs and optimizing the usage of AWS resources. These recommendations are based on usage patterns, cost analysis, and resource configurations, helping organizations achieve better cost efficiency.
Table Usage Guide
The aws_costoptimizationhub_recommendation
table in Steampipe allows you to query detailed cost optimization recommendations. This table helps DevOps engineers, cost analysts, or financial professionals identify potential savings, understand implementation efforts, and track the effectiveness of recommendations.
The schema outlines various attributes of the cost optimization recommendations, including estimated savings, resource details, recommendation types, and implementation efforts. It also provides timestamps for the last refresh and additional metadata such as tags and ARNs.
Important Notes
- This table supports optional quals. Queries with optional quals are optimized to use additional filtering provided by the AWS API function to narrow down the results for better query performance.. Optional quals are supported for the following columns:
recommendation_account_id
action_type
implementation_effort
recommendation_id
resource_region
resource_arn
resource_id
current_resource_type
recommended_resource_type
restart_needed
rollback_possible
Examples
Basic info
Retrieve the basic details of cost optimization recommendations, including the resource and estimated savings.
select recommendation_id, resource_id, estimated_monthly_savings, estimated_savings_percentage, implementation_effortfrom aws_costoptimizationhub_recommendation;
select recommendation_id, resource_id, estimated_monthly_savings, estimated_savings_percentage, implementation_effortfrom aws_costoptimizationhub_recommendation;
List recommendations with significant savings
Identify recommendations where the estimated savings percentage is greater than 50%. This helps prioritize high-impact cost optimization opportunities.
select recommendation_id, resource_id, estimated_monthly_savings, estimated_savings_percentagefrom aws_costoptimizationhub_recommendationwhere estimated_savings_percentage > 50;
select recommendation_id, resource_id, estimated_monthly_savings, estimated_savings_percentagefrom aws_costoptimizationhub_recommendationwhere estimated_savings_percentage > 50;
List recommendations requiring a resource restart
Find recommendations that require a restart to implement. This query helps in planning implementation efforts and minimizing downtime.
select recommendation_id, resource_id, implementation_effort, restart_neededfrom aws_costoptimizationhub_recommendationwhere restart_needed = true;
select recommendation_id, resource_id, implementation_effort, restart_neededfrom aws_costoptimizationhub_recommendationwhere restart_needed = 1;
Get recommendations by resource type
Filter recommendations based on specific resource types, such as EC2 or RDS, to analyze opportunities for optimizing particular services.
select recommendation_id, resource_id, current_resource_type, recommended_resource_typefrom aws_costoptimizationhub_recommendationwhere current_resource_type = 'EC2';
select recommendation_id, resource_id, current_resource_type, recommended_resource_typefrom aws_costoptimizationhub_recommendationwhere current_resource_type = 'EC2';
List recommendations refreshed in the last 30 days
Track recently updated recommendations to stay up-to-date with the latest cost optimization insights.
select recommendation_id, resource_id, last_refresh_timestampfrom aws_costoptimizationhub_recommendationwhere last_refresh_timestamp > now() - interval '30 days';
select recommendation_id, resource_id, last_refresh_timestampfrom aws_costoptimizationhub_recommendationwhere last_refresh_timestamp > datetime('now', '-30 days');
Get the tags associated with a recommendation
Retrieve tags assigned to recommendations to better organize and manage resources.
select recommendation_id, resource_id, jsonb_each_text(tags) as tagfrom aws_costoptimizationhub_recommendation;
select recommendation_id, resource_id, json_each(tags_src).key as tag_key, json_each(tags_src).value as tag_valuefrom aws_costoptimizationhub_recommendation;
Schema for aws_costoptimizationhub_recommendation
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form. | |
account_id | text | =, !=, ~~, ~~*, !~~, !~~* | The AWS Account ID in which the resource is located. |
action_type | text | = | The type of tasks that can be carried out by this action. |
currency_code | text | The currency code used for the recommendation. | |
current_resource_details | jsonb | The details for the resource. | |
current_resource_summary | text | Describes the current resource. | |
current_resource_type | text | = | The current resource type. |
estimated_monthly_cost | double precision | The estimated monthly cost for the recommendation. | |
estimated_monthly_savings | double precision | The estimated monthly savings amount for the recommendation. | |
estimated_savings_percentage | double precision | The estimated savings percentage relative to the total cost over the cost calculation lookback period. | |
implementation_effort | text | = | The effort required to implement the recommendation. |
last_refresh_timestamp | timestamp with time zone | The time when the recommendation was last generated. | |
partition | text | The AWS partition in which the resource is located (aws, aws-cn, or aws-us-gov). | |
recommendation_account_id | text | = | The account that the recommendation is for. |
recommendation_id | text | = | The ID for the recommendation. |
recommendation_lookback_period_in_days | bigint | The lookback period that's used to generate the recommendation. | |
recommended_resource_details | jsonb | The details about the recommended resource. | |
recommended_resource_summary | text | Describes the recommended resource. | |
recommended_resource_type | text | = | Describes the recommended resource. |
region | text | The AWS Region in which the resource is located. | |
resource_arn | text | = | The Amazon Resource Name (ARN) for the recommendation. |
resource_id | text | = | The resource ID for the recommendation. |
resource_region | text | = | The Amazon Web Services Region of the resource. |
restart_needed | boolean | = | Whether or not implementing the recommendation requires a restart. |
rollback_possible | boolean | = | Whether or not implementing the recommendation can be rolled back. |
source | text | The source of the recommendation. | |
sp_connection_name | text | =, !=, ~~, ~~*, !~~, !~~* | Steampipe connection name. |
sp_ctx | jsonb | Steampipe context in JSON form. | |
tags | jsonb | A map of tags for the resource. | |
tags_src | jsonb | A list of tags assigned to the recommendation. | |
title | text | Title of the resource. |
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_costoptimizationhub_recommendation