CloudQuery News

AWS Cost Transformation is Now Available!

In need of a one-stop solution to tracking your AWS costs and usage?

Finding valuable and actionable data from the many available AWS sources can be a daunting task. There are many disparate sources within AWS that, while all being valuable on their own, make it difficult to find and house your usage, cost, and utilization data.

That is why we have developed a new AWS Cost Policy. This policy contains transformations that leverage both CloudQuery provided tables and your readily available Cost and Usage Report from AWS. When generating this report, please ensure that include resource IDs is selected for compatibility.

We have simplified this process utilizing CloudQuery's AWS Source Integration, S3 Source Integration, and PostgreSQL Destination Integration .

With this new set of transformations, you will be able to ensure that your usage and any potential costs incurred are optimized to your needs.

What are some use cases for this policy?

  • Monitoring costs - quickly get a clear snapshot of any cost or expenditure incurred on different AWS resources, this will allow you to make decisions on how to properly optimize and configure AWS resources exactly to your needs
  • Monitoring usage - ensure that the services you have activated in your AWS accounts are being utilized properly
  • Compute optimization - gain actionable recommendations at a glance from the AWS cost optimizer data made available in your CloudQuery tables
  • Usage optimization - gain actionable insights at a glance from the tables created by the policy

Let's walk through a few use case examples together

Set up

In order for this policy to be run successfully, you must sync your AWS metadata with the CloudQuery AWS source integration, Cost and Usage data with the S3 source integration, and PostgreSQL destination, as mentioned previously.

Download the CloudQuery CLI and use the configs below to sync the data required for this policy. Don't forget to set the specific bucket, region and path to the files for S3 and a connection string to your PostgreSQL destination database.

kind: source
spec:
name: s3
version: v1.3.3
destinations: ['postgresql']
path: cloudquery/s3
registry: cloudquery
tables: ['*']
spec:
bucket: ''
region: ''
path_prefix: ''
---
kind: source
spec:
name: aws
version: v24.3.3
destinations: ['postgresql']
path: cloudquery/aws
tables: ['*']
---
kind: destination
spec:
name: postgresql
path: cloudquery/postgresql
version: 'v7.3.6'
spec:
connection_string: postgresql://postgres:pass@localhost:5432/postgres

Run the sync with cloudquery sync config.yaml command.

Now that we have everything configured and synced let us run the transformation from our cost policy directory using the command:

dbt run --vars '{"cost_usage_table": ""}'

Once that command has run successfully, you should see views starting with aws_cost__ or aws_usage in your database. For the list of all views and their documentation, see the AWS Cost transformation documentation.

Example queries

Top 5 highest spending accounts

Let's say you have a multi-tenant set-up and you want to see which accounts are incurring the most cost. The view aws_cost__by_account will house this information. Here is how you can get the top 5 accounts that have incurred the most cost:

select * from aws_cost__by_account
order by cost desc
limit 5;

This query will show you the identifier for each of the top spending accounts alongside how much those accounts have spent. Check the image below to view a sample result from this query:

Query results showing the top 5 highest spending AWS accounts with cost breakdown

Finding under-utilized resources

Another common stumbling block to gaining clear insight to your AWS costs is finding under-utilized
resources in your AWS accounts that may be incurring costs:

The most used service in all of AWS is its EC2 offerings. However, it can be difficult to keep track of all EC2 instances to ensure that they are all optimized and performing as expected. With this new policy, you will have access to utilization data so you can be confident that your instances are utilized properly.

Here is a ready-made query to unearth potentially under-utilized instances:

SELECT *
FROM aws_cost__by_under_utilized_resources
WHERE service = 'EC2'
ORDER BY cost DESC
limit 10;
Query results showing under-utilized EC2 instances with CPU utilization metrics and associated costs

This query is slightly more granular than our previous example. You will receive some specific information about your EC2 instances:

  • service name - defaulted to 'EC2' for this example
  • resource id - this is the identifier for each specific EC2 instance you have
  • metric - this is the actual statistic being tracked, for EC2s that statistic is CPU Utilization
  • mean usage - this is the average CPU utilization for each EC2 instance
  • max usage - this is the highest CPU utilization for each EC2 instance
  • cost - this is the total cost incurred by the EC2 instance

Visualizing your data

Along with the transformations, we have included a suite of visualizations using Grafana that leverage your newly transformed AWS costs. You can find documentation on how to set up your own visualization here. For now, let's check out some examples below:

Grafana dashboard showing overall AWS cost summary with spending trends and account breakdown

General cost dashboard

Grafana chart showing AWS cost breakdown by service with top spending services highlighted

Cost per service

Grafana time-series chart showing AWS cost trends over time with spending patterns visible

Cost trends


Want to see CloudQuery in action? Schedule a demo with our team or check out the platform documentation to learn more.

Want help getting started? Join the CloudQuery community to connect with other users and experts, or message our team directly here if you have any questions.

Try CloudQuery yourself

Self-hosted, open source, and free to start. Or schedule a demo to see the managed version.

Related posts

CloudQuery News

Introducing CloudQuery Insights: Cloud Intelligence That Connects the Dots

CloudQuery Insights automatically surfaces connected signals across your cloud inventory: security findings, cost data, policy violations, and audit trails.

Joe Karlsson

Joe Karlsson

April 21, 2026

Cloud Infrastructure

CloudQuery News

Introducing the Nautobot Source Integration

Sync Nautobot DCIM inventory data to PostgreSQL, BigQuery, or Snowflake and query it with SQL alongside your cloud provider data.

Joe Karlsson

Joe Karlsson

March 19, 2026

CloudQuery News

CloudQuery Is Merging with Env Zero

A letter from CloudQuery CEO Yevgeny Pats on the merger with env zero and what it means for customers.

Yevgeny Pats

Yevgeny Pats

March 17, 2026

CloudQuery News

Security

Introducing the Zoom Source Integration

New CloudQuery Zoom source plugin: sync Zoom meeting, user, and webinar data into your database for compliance, analytics, and user access governance reporting.

Joe Karlsson

Joe Karlsson

February 2, 2026

CloudQuery News

Product News

New in CloudQuery: Tines + Semgrep integration, and native visualizations,

CloudQuery October 2025 updates: Tines and Semgrep integration for security orchestration, plus native visualization support in the CloudQuery Platform.

Chris Reuter

Chris Reuter

October 31, 2025

CloudQuery News

Product News

Security

Introducing Data Access Control for CloudQuery Platform

CloudQuery Platform RBAC: Control cloud asset access with SQL-based permissions. Map Azure AD/Okta groups to roles. Available now on all environments.

Joe Karlsson

Joe Karlsson

October 28, 2025

AI

CloudQuery News

Understand your cloud infra faster using natural language

CloudQuery unifies AWS, GCP, Azure, and SaaS configs into SQL tables. The new AI assistant lets you query your cloud inventory using natural language.

Chris Reuter

Chris Reuter

September 29, 2025

CloudQuery News

Find the Cloud Waste Contest

Win CloudQuery swag by finding cloud waste in our dataset. Sync AWS data with CloudQuery, solve 3 SQL challenges, get t-shirts, sweatshirts, and mugs.

Joe Karlsson

Joe Karlsson

September 25, 2025

AI

CloudQuery News

Generate CloudQuery Configuration with Natural Language

Generate CloudQuery config files from natural language prompts. Use AI to quickly create source and destination plugin configs without manual YAML editing.

Chris Reuter

Chris Reuter

September 23, 2025

Own your pipeline.
Own your data.