Product News

Smarter, faster syncs with CloudQuery's automatic sharding

Introduction

When you run a sync with CloudQuery for a service with a large amount of data, such as AWS, it can often take hours to complete. One way to make the sync finish faster is to split the configuration and run syncs in parallel based on tables, accounts, or any other way that makes sense for the particular service.

Setting everything up can be quite tedious and the setup requires continuous maintenance. You need to figure out the best way to split the configs for your specific environment, build and run containers with the configs, and when you need to change something, you almost need to start from scratch.

Previously, we made it easier to understand the details of each sync to help you split configs manually. Our latest improvement to our SDK and CloudQuery CLI, sharding, enables you to split them automatically. Let's dive deeper into how the automatic sharding works in CloudQuery.

What is automatic sharding?

Automatic sharding is an approach to data transfer that enables parallel processing to deliver increased transaction throughput and performance.

CloudQuery benefits from its extensible architecture and achieves this by splitting the collection of tables provided by the integration into groups. When you run the cloudquery sync command and provide the number of shards and the shard number, the sharded sync will determine what tables it is responsible for and will sync only those tables, assuming you will run the sync command for other shards as well.

Here is a practical example: To split a long running sync into two shards that can be run in parallel, run the following commands independently:

cloudquery sync config.yml --shard 1/2
cloudquery sync config.yml --shard 2/2

It really is that simple! CloudQuery will determine which tables to sync and when both syncs finish, all the data will be in your destination.

Real-World Use Cases

This new feature makes it easy to run syncs using popular continuous integration (CI) or orchestration platforms, such as GitHub actions. With the GitHub Actions matrix configuration, it is super easy to split your syncs into multiple jobs and run them in parallel:

name: CloudQuery Parallel
on:
schedule:
- cron: '0 3 * * *' # Run daily at 03:00 (3am)
jobs:
cloudquery:
permissions:
id-token: write
contents: read
runs-on: ubuntu-latest
strategy:
matrix:
shard: [1/4, 2/4, 3/4, 4/4] # Split the sync into 4 parts
steps:
- uses: actions/checkout@v3 # Checkout the code so we have access to the config file
- name: Configure AWS credentials # Setup AWS credentials (example)
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: # based on the role you created in the prerequisites
aws-region: # based on the region you created the role in
- uses: cloudquery/setup-cloudquery@v3
name: Setup CloudQuery
with:
version: 'v6.8.1'
- name: Sync with CloudQuery
run: cloudquery sync config.yml --log-console --shard ${{ matrix.shard }}
env:
CLOUDQUERY_API_KEY: ${{ secrets.CLOUDQUERY_API_KEY }} # See https://www.cloudquery.io/docs/cli/managing-cloudquery/deployments/generate-api-key
CQ_DSN: ${{ secrets.CQ_DSN }} # Connection string to a PostgreSQL database

To learn more about this feature, take a look at our documentation. We have also prepared a full guide on how to deploy CloudQuery with GitHub Actions to help make running these syncs even more straightforward.

Future Plans

We are planning to make further improvements. Right now, table splitting is done on the SDK/CLI level. In the future, we plan to make the plugins smarter and advise the CLI how to split the syncs with respect to known rate limits or data throughputs of the individual services, or based on the telemetry recorded from a previous sync.

If you tried this feature, and have some more ideas for improvements, we’d love to hear from you!. Reach out to the team on our Community portal.

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

Try CloudQuery yourself

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

Related posts

AWS

Cloud Asset Inventory

Product News

AWS Relations Transformer: Every Dependency in One Table

The AWS Relations transformer writes every reference between your synced AWS resources to one SQL table. Try the v1.0.0 preview and tell us what you build.

CloudQuery Team

CloudQuery Team

September 27, 2026

AI

Cloud Asset Inventory

Product News

CloudQuery Platform Adds Business Context and Scheduled Exports to Cloud Inventory

CloudQuery Platform now groups cloud resources into apps and environments, and lets you schedule automated data exports to your data warehouse on a cron.

Zeen Rachidi

Zeen Rachidi

August 31, 2026

AI

Product News

What's new in the CloudQuery Platform AI Assistant

The CloudQuery Platform AI Assistant just got a major upgrade enabling you to build reports from chat, revisit past conversations, manage policies conversationally, and more.

Zeen Rachidi

Zeen Rachidi

July 16, 2026

AI

Product News

Try CloudQuery Platform Today: Self-Service Signup Is Here

CloudQuery's Platform now offers self-service signup

Zeen Rachidi

Zeen Rachidi

June 18, 2026

AI

Product News

Introducing the CloudQuery Platform AI Assistant

CloudQuery's new AI Assistant lets you ask questions about your cloud infrastructure in plain English - no SQL required.

Joe Karlsson

Joe Karlsson

May 18, 2026

Cloud Asset Inventory

Product News

A Field Guide to Finding Zombie Infrastructure in AWS

Three playbooks for identifying zombie cloud resources - abandoned databases, forgotten prototypes, and unowned compute - using AWS CLI, SQL, and Insights.

Joe Karlsson

Joe Karlsson

April 2, 2026

Product News

Security

Investigating Toxic IAM and Access Combinations in AWS

Three investigation playbooks for finding toxic signal combinations in AWS - stale credentials, open SSH, and unowned compute - with SQL and Insights.

Joe Karlsson

Joe Karlsson

April 2, 2026

Product News

Security

How to Find GitHub Repos Vulnerable to Supply Chain Attacks Like CanisterWorm

Find which of your GitHub repos are vulnerable to fork PR supply chain attacks like CanisterWorm, and how to fix the settings before they're exploited.

Ştefan Muraru

Ştefan Muraru

March 25, 2026

Product News

Introducing the Markmonitor Integration for CloudQuery

CloudQuery's new Markmonitor integration syncs your enterprise domain portfolio into your data warehouse for domain expiration tracking and DNSSEC analysis.

Joe Karlsson

Joe Karlsson

March 12, 2026

Own your pipeline.
Own your data.