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

**URL:** <https://community.cloudquery.io/t/help-needed-with-cloudquery-setup-on-gcp-using-cloud-run-or-functions/598>\
**Category:** CloudQuery Plugins\
**Created:** [November 6, 2023, 3:02pm UTC](https://community.cloudquery.io/t/help-needed-with-cloudquery-setup-on-gcp-using-cloud-run-or-functions/598 "2023-11-06T15:02:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![fitting-shrew](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@fitting-shrew](https://community.cloudquery.io/u/fitting-shrew)\
**Post date:** [November 6, 2023, 3:02pm UTC](https://community.cloudquery.io/t/help-needed-with-cloudquery-setup-on-gcp-using-cloud-run-or-functions/598/1 "2023-11-06T15:02:45Z")

</div>

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](https://www.cloudquery.io/docs/deployment/cloud-run)), but was wondering if anyone has tried Cloud Functions ([Cloud Functions Documentation](https://cloud.google.com/functions?hl=en))?

---

<div class="post-metadata">

**Author:** ![ben](https://sea1.discourse-cdn.com/flex001/user_avatar/community.cloudquery.io/ben/32/88_2.png) [@ben](https://community.cloudquery.io/u/ben)\
**Post date:** [November 6, 2023, 3:17pm UTC](https://community.cloudquery.io/t/help-needed-with-cloudquery-setup-on-gcp-using-cloud-run-or-functions/598/2 "2023-11-06T15:17:15Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![fitting-shrew](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@fitting-shrew](https://community.cloudquery.io/u/fitting-shrew)\
**Post date:** [November 6, 2023, 3:18pm UTC](https://community.cloudquery.io/t/help-needed-with-cloudquery-setup-on-gcp-using-cloud-run-or-functions/598/3 "2023-11-06T15:18:17Z")

</div>

I was planning to modify this [cloudrun-example](https://github.com/cloudquery/cloudrun-example/tree/main). 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.

---

<div class="post-metadata">

**Author:** ![ben](https://sea1.discourse-cdn.com/flex001/user_avatar/community.cloudquery.io/ben/32/88_2.png) [@ben](https://community.cloudquery.io/u/ben)\
**Post date:** [November 6, 2023, 3:24pm UTC](https://community.cloudquery.io/t/help-needed-with-cloudquery-setup-on-gcp-using-cloud-run-or-functions/598/4 "2023-11-06T15:24:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fitting-shrew](https://avatars.discourse-cdn.com/v4/letter/f/3e96dc/32.png) [@fitting-shrew](https://community.cloudquery.io/u/fitting-shrew)\
**Post date:** [November 6, 2023, 3:28pm UTC](https://community.cloudquery.io/t/help-needed-with-cloudquery-setup-on-gcp-using-cloud-run-or-functions/598/5 "2023-11-06T15:28:35Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![ben](https://sea1.discourse-cdn.com/flex001/user_avatar/community.cloudquery.io/ben/32/88_2.png) [@ben](https://community.cloudquery.io/u/ben)\
**Post date:** [November 8, 2023, 2:00pm UTC](https://community.cloudquery.io/t/help-needed-with-cloudquery-setup-on-gcp-using-cloud-run-or-functions/598/6 "2023-11-08T14:00:37Z")

</div>

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.
