---
title: Query your data with NRQL
source: https://docs.newrelic.com/docs/cci/financial-intelligence/nrql-for-cci
---

> #### 💡 PREVIEW
>
> We're still working on this feature, but we'd love for you to try it out!
>
> This feature is currently provided as part of a preview program pursuant to our [pre-release policies](https://docs.newrelic.com/docs/licenses/license-information/referenced-policies/new-relic-pre-release-policy).

Query your Cloud Cost Intelligence (CCI) data with the New Relic Query Language (NRQL) to analyze your cloud spending and identify cost optimization opportunities. To run any of the queries on this page, go to **[one.newrelic.com](https://one.newrelic.com) > All Capabilities > Cloud Cost Intelligence** and open the **Query your data**.

## Available event types [#event-types]

You can query the following event types, each with a set of attributes for building detailed cost and usage queries. Event types with **Full** NRQL support accept any valid NRQL clause. Event types with **Limited** NRQL support accept only the clauses listed in [Supported NRQL clauses](#supported-nrql-clauses):

| Event type          | Description                                                                                                                                                                                                                                     | NRQL support |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| `CloudSpend`        | One event per billing line item from your cloud provider (AWS CUR, Azure FOCUS, and GCP BigQuery), updated hourly. Use for granular, unaggregated cost analysis.                                                                                | Full         |
| `KubernetesSpend`   | Individual Kubernetes cost allocation records from New Relic telemetry combined with billing exports, broken down by cluster, namespace, pod, and container. Use `net_unblended_cost * (cpu_weightage + memory_weightage)` for accurate totals. | Full         |
| `CloudCost`         | Billing data pre-aggregated from `CloudSpend`, updated hourly. Best for dashboards and trend queries.                                                                                                                                           | Limited      |
| `KubernetesCost`    | Pre-processed Kubernetes cost data by cluster, namespace, pod, and container. Use `net_unblended_cost * (cpu_weightage + memory_weightage)` for accurate cost totals.                                                                           | Limited      |
| `CloudCostEstimate` | Real-time cost estimates generated by CCI at the resource level, including AWS instance details and metadata such as `owning_team`, `environment`, and `service_name`. Use for in-flight monitoring before billing data arrives.                | Limited      |

For a complete, always up-to-date reference of the events and attributes available in your account, use the [data dictionary](/attribute-dictionary). To write effective [NRQL](https://docs.newrelic.com/docs/nrql/get-started/introduction-nrql-new-relics-query-language) queries, see the [Introductory NRQL tutorial](https://docs.newrelic.com/docs/nrql/nrql-tutorials/introduction-nrql-tutorial).

## CloudSpend [#cloudspend]

`CloudSpend` and `CloudCost` contain the same billing data from your cloud provider, but differ in their NRQL capabilities. `CloudSpend` supports the full NRQL language and is the recommended choice for all new queries. `CloudCost` supports only a subset of NRQL clauses and is planned for deprecation.

`CloudSpend` ingests raw billing line items from AWS Cost and Usage Reports (CUR), Azure FOCUS exports, and GCP BigQuery exports, updated hourly. It shares key attributes with `CloudCost`, including `line_item_net_unblended_cost`, `line_item_product_code`, and `line_item_usage_account_id`. For a complete attribute reference, see the [data dictionary](/attribute-dictionary).

Example query:

```sql
FROM CloudSpend SELECT * SINCE 24 hours ago
```

Find your total cloud spend broken down by service over the last month:

```sql
FROM CloudSpend SELECT SUM(line_item_net_unblended_cost) FACET line_item_product_code SINCE 1 month ago
```

See how daily cloud spend is trending over time:

```sql
FROM CloudSpend SELECT SUM(line_item_net_unblended_cost) TIMESERIES 1 day SINCE 30 days ago
```

## KubernetesSpend [#kubernetesspend]

`KubernetesSpend` stores individual cost allocation records for Kubernetes workloads. It combines New Relic infrastructure telemetry with cloud billing exports to break down costs by cluster, namespace, pod, and container, and supports the full NRQL language.

Because Kubernetes node costs are shared across workloads, `KubernetesSpend` distributes them proportionally using `cpu_weightage` and `memory_weightage`. Multiply `net_unblended_cost` by `(cpu_weightage + memory_weightage)` for accurate per-workload cost totals. For a complete attribute reference, see the [data dictionary](/attribute-dictionary).

Example query:

```sql
FROM KubernetesSpend SELECT * SINCE 1 week ago
```

## CloudCost [#cloudcost]

> #### ⚠️ IMPORTANT
>
> We recommend using `CloudSpend` for all cost and usage analysis. It provides the same billing data as `CloudCost` with full NRQL support.

`CloudCost` is a summary event generated by Cloud Cost Intelligence from cloud provider Cost and Usage Reports (CUR). It provides billing line item data including resource usage, costs, and account metadata across AWS and Azure accounts, updated hourly. Because `CloudCost` is pre-aggregated, it supports only a subset of NRQL clauses. For full NRQL flexibility, use `CloudSpend`.

### Key attributes

The following attributes are most useful for building CloudCost queries:

| Attribute                      | Description                                                                                               |
| ------------------------------ | --------------------------------------------------------------------------------------------------------- |
| `line_item_net_unblended_cost` | After-discount cost for the line item, specific to the individual account.                                |
| `line_item_product_code`       | Cloud provider service code (for example, `AmazonEC2` for AWS or `Virtual Machine Scale Sets` for Azure). |
| `line_item_usage_account_id`   | 12-digit AWS account ID of the account that used this line item.                                          |
| `line_item_usage_account_name` | Display name of the cloud account or subscription.                                                        |
| `line_item_unblended_cost`     | Cost at standard On-Demand rates before any Reserved Instance, Savings Plan, or volume discounts.         |
| `amortised_cost`               | Amortized cost including upfront reservation or savings plan fees spread over the usage period.           |
| `is_k8s`                       | Flag indicating whether the cost is associated with a Kubernetes workload.                                |

Example query:

```sql
FROM CloudCost SELECT * SINCE 24 hours ago
```

![Cloud Cost Intelligence Budgets query console showing CloudCost attributes](https://docs.newrelic.com/images/cci-cloudcost-query.webp "Cloud Cost Intelligence Budgets query console showing CloudCost attributes")

## KubernetesCost [#kubernetescost]

`KubernetesCost` is a cost allocation event generated by Cloud Cost Intelligence. It breaks down cloud costs by Kubernetes cluster, namespace, pod, and container. This event type supports only a subset of NRQL clauses.

### Key attributes

The following attributes are most useful for building KubernetesCost queries:

| Attribute            | Description                                                                                    |
| -------------------- | ---------------------------------------------------------------------------------------------- |
| `total_cost`         | Total cost, calculated as the sum of `cpu_costs` and `memory_costs`.                           |
| `cpu_costs`          | Portion of the cost attributed to CPU usage.                                                   |
| `memory_costs`       | Portion of the cost attributed to memory usage.                                                |
| `net_unblended_cost` | Net cost after discounts, based on the resource's usage share of the underlying EC2 node cost. |
| `cpu_usage`          | Ratio of CPU cores in use to CPU cores allocated (value between 0 and 1).                      |
| `memory_usage`       | Ratio of memory in use to memory allocated (value between 0 and 1).                            |
| `cluster_name`       | Name of the cluster hosting the nodes and pods.                                                |
| `namespace_name`     | Kubernetes namespace—a logical separation of services and deployment nodes.                    |
| `pod_name`           | Kubernetes pod name, which may host one or more containers.                                    |
| `container_name`     | Docker container name.                                                                         |
| `node_name`          | EC2 node on which the pod is deployed.                                                         |
| `deployment_name`    | Name of the Kubernetes Deployment managing the pod.                                            |

Example query:

```sql
FROM KubernetesCost SELECT * SINCE 1 week ago
```

For accurate Kubernetes costs, multiply `cpu_weightage + memory_weightage` in your queries:

```sql
SELECT SUM(net_unblended_cost * (cpu_weightage + memory_weightage) + network_net_unblended_cost) FROM KubernetesCost SINCE '2026-09-01' UNTIL '2026-09-10'
```

The query multiplies `net_unblended_cost` by the sum of CPU and memory weightage for accurate cost allocations based on resource usage.

![Query Console showing KubernetesCost event attributes](https://docs.newrelic.com/images/kubernetes-cost-cci.webp "Query Console showing KubernetesCost event attributes")

Identify the most expensive Kubernetes namespaces:

```sql
FROM KubernetesCost SELECT SUM(total_cost) FACET namespace_name SINCE 1 week ago LIMIT 10
```

Compare CPU cost to memory cost per cluster:

```sql
FROM KubernetesCost SELECT SUM(cpu_costs), SUM(memory_costs) FACET cluster_name SINCE 1 week ago
```

Find under-utilized containers where CPU usage is low:

```sql
FROM KubernetesCost SELECT average(cpu_usage) FACET container_name WHERE cpu_usage < 0.2 SINCE 3 days ago
```

## CloudCostEstimate [#cloudcostestimate]

`CloudCostEstimate` is a real-time event generated by Cloud Cost Intelligence. It provides estimated cloud costs at the resource level, including AWS instance details and metadata such as team ownership, environment, and service name. This event type supports only a subset of NRQL clauses.

### Key attributes

The following attributes are most useful for building CloudCostEstimate queries:

| Attribute       | Description                                                                               |
| --------------- | ----------------------------------------------------------------------------------------- |
| `cost`          | Estimated cost in the currency of your cloud bill for the resource over the usage period. |
| `owning_team`   | Value of the `owning_team` tag applied to the resource, if present.                       |
| `product_code`  | Cloud provider service code (for example, `EC2`).                                         |
| `service_name`  | The service the estimate is for.                                                          |
| `instance_type` | AWS EC2 instance type (for example, `m6g.8xlarge`). Applies to AWS resources only.        |
| `aws_region`    | AWS region where the resource is deployed (for example, `us-east-2`).                     |
| `department`    | Value of the `department` tag applied to the resource, if present.                        |
| `environment`   | Deployment environment of the resource, sourced from the resource's `environment` tag.    |

Example query:

```sql
FROM CloudCostEstimate SELECT * SINCE 24 hours ago
```

![Query Console showing CloudCostEstimate event attributes](https://docs.newrelic.com/images/cloud-cost-estimate.webp "Query Console showing CloudCostEstimate event attributes")

Review estimated costs by owning team:

```sql
FROM CloudCostEstimate SELECT SUM(cost) FACET owning_team SINCE 24 hours ago
```

## Supported NRQL clauses [#supported-nrql-clauses]

The following clauses are supported for `CloudCost`, `KubernetesCost`, and `CloudCostEstimate`. `CloudSpend` and `KubernetesSpend` support the full NRQL language.

| Category            | Supported clauses                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Clauses             | [`SELECT`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#state-select), [`WHERE`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#sel-where), [`SINCE`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#sel-since), [`UNTIL`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#sel-until), [`LIMIT`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#sel-limit), [`TIMESERIES`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#sel-timeseries), [`TIMESERIES… FACET…`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#func-dimensions) |
| Aggregate functions | [`COUNT`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#func-count), [`SUM`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#func-sum), [`MIN`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#func-min), [`MAX`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#timeseries-max), [`UNIQUES()`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#func-uniques), [`UNIQUECOUNT()`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#uniquecount)                                                                                                            |
| Operators           | [`LIKE`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#sel-where), [`IN`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#sel-where), [`NOT IN`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#sel-where), [`AND`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#sel-where), [`OR`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#sel-where), [`<`, `<=`, `>`, `>=`, `!=`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#sel-where)                                                                                                                |
| Time functions      | [`DATEOF()`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#sel-timezone), [`HOUROF()`](https://docs.newrelic.com/docs/nrql/nrql-syntax-clauses-functions/#func-minOf)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |

## Related topics [#related-topics]

[Troubleshooting](https://docs.newrelic.com/docs/cci/troubleshooting/troubleshooting)

Resolve common issues during Cloud Cost Intelligence setup

[Intelligent summary](https://docs.newrelic.com/docs/cci/financial-intelligence/intelligent-summary)

[Cost overview](https://docs.newrelic.com/docs/cci/financial-intelligence/cost-overview)

[Kubernetes cost insights](https://docs.newrelic.com/docs/cci/financial-intelligence/k8s-cost-insights)

[Budgets](https://docs.newrelic.com/docs/cci/financial-intelligence/cci-budgets)

[Cost optimization recommendations](https://docs.newrelic.com/docs/cci/financial-intelligence/cci-recommendations)

[Query your data with NRQL](https://docs.newrelic.com/docs/cci/financial-intelligence/nrql-for-cci)
