Help needed with CloudQuery setup on GCP using Cloud Run or Functions

Hello! I am new to CloudQuery and planning to work on a POC with GCP input sources and a PostgreSQL destination.

The infra needs to run on GCP.

I am leaning towards Cloud Run + Cloud Scheduler (Cloud Run Documentation), but was wondering if anyone has tried Cloud Functions (Cloud Functions Documentation)?

Hi @fitting-shrew,

I do not know of anyone using Cloud Functions to run CloudQuery. I just took a look at it, and it seems like technically it might be possible, but you would have to write your own HTTP handler to call the CQ CLI as that is the entry point into a sync.

I am interested in learning more about your use case and what you are trying to accomplish with running on Cloud Functions, as well as what you are aiming to do with the underlying data! Happy syncing!

I was planning to modify this cloudrun-example. The HTTP handler seems to work fine in basic tests.

The only reason for using Cloud Function would be from a costs perspective - it only gets invoked on a weekly sync, for example.

That is a great starting point. Just remember CloudRun has the 1-hour limitation, so any sync that lasts longer than that will be cut off mid-sync.

Thanks, Ben! It seems like it will work - just a path less traveled. :slightly_smiling_face:

My main use case will be for inventory management and Cloud Security Posture Management (CSPM).

That’s great! The asset inventory/CSPM is a common use case for CloudQuery data. If you have any feedback based on your experience running CloudQuery in Cloud Run, we would love to incorporate it in our docs.