CloudQuery News

Announcing CloudQuery Policies

HCL policies were deprecated - see up-to-date policy documentation here.

We are excited to announce the release of the CloudQuery Policies!

CloudQuery brings the power of SQL to your cloud infrastructure, providing easy monitoring, governance and security.

The new CloudQuery Policies feature brings policy-as-code to the CloudQuery ecosystem. CloudQuery Policies enable users to codify, version and run security, governance, cost and compliance rules, using SQL.

What’s inside?

  • HCL support: Policies can be written in HCL and/or JSON as the logical layer and SQL as the query layer.
  • Native GitHub support: Policies can be downloaded and run directly from GitHub via the CloudQuery CLI (cloudquery policy download --help)
  • Views: Users can create complex SQL views once and reference them in subsequent queries.
  • Query and sub-policy execution: Users can execute specific queries or sub-policies via CloudQuery CLI (cloudquery policy run my-policy --sub-path=my-sub-policy).
  • Inline policy functions: New inline policy functions are now available that allow users to define more dynamic policies. One example is the new file function that allows users to out-source query definitions to other files and to dynamically insert them during execution time.

For detailed documentation please check-out our docs.

Example Policies

Basic

At the basic level, each policy contains the minimum version of cq-provider that it requires, and a list of SQL queries with their respective description.

policy "test-policy" {
description = "This is a test policy"
configuration {
provider "aws" {
version = ">= 1.0"
}
}

query "top-level-query" {
description = "Top Level Query"
query = "SELECT * FROM test_policy_table WHERE name LIKE 'peter'"
}
}

Views

Sometimes there is the need to join between multiple tables. Instead of creating complex queries multiple times, views gives you the ability to define the view once and then reference the created view in other queries in your policies.

policy "test-policy" {
description = "This is a test policy"
configuration {
provider "aws" {
version = ">= 1.0"
}
}

view "myview" {
description = "My awesome view"
query "complex-query" {
query = "SELECT * FROM test_policy_table WHERE name LIKE 'john'"
}
}

query "top-level-query" {
description = "Top Level Query"
query = "SELECT * FROM myview"
}
}

Policy-In-Policy

It is possible to nest policies inside policies to build a policy hierarchy that will give you the ability to reference and execute only a subset of the main policy file.

policy "test-policy" {
description = "Test Policy"
configuration {
provider "aws" {
version = ">= 1.0"
}
}

view "testview" {
description = "Test View"
query "testviewquery" {
query = "SELECT * FROM test_policy_table WHERE name LIKE 'john'"
}
}

query "top-level-query" {
description = "Top Level Query"
query = "SELECT * FROM test_policy_table WHERE name LIKE 'peter'"
}

policy "sub-policy-1" {
description = "Sub Policy 1"
query "sub-level-query" {
query = "SELECT * from testview"
expect_output = true
}

policy "sub-sub-policy-1" {
description = "Sub Sub Policy 1"
query "sub-sub-level-query" {
query = "SELECT * from test_policy_table WHERE name LIKE 'peter'"
}
}
}

policy "sub-policy-2" {
description = "Sub Policy 2"
query "sub-level-query" {
query = "SELECT * from test_policy_table WHERE name LIKE 'peter'"
}
}
}

Running

We extended the CloudQuery CLI to support downloading and running policies directly from GitHub.

Download a policy repository:

cloudquery policy download cq-policy-core

Run specific policy (latest version):

cloudquery policy run cq-policy-core aws/cis-v1.20

Run specific policy version:

cloudquery policy run cq-policy-core aws/[email protected]

You can also run a specific query inside a policy:

cloudquery policy run cq-policy-core aws/cis-v1.20 --sub-path="aws-cis-section-1/1.1"

What’s Next?

We are always eager to hear feedback so feel free to file feature-requests/bugs/issues on our GitHub.

Also, we have more exciting features coming up to enhance the new policy feature so subscribe to our twitter and/or mailing list.

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.