Why do we need Pub/Sub with Cloud Scheduler in GCP?

Viewed 89

I am reading this https://cloud.google.com/scheduler/docs/tut-pub-sub They use the setup like below:

Cloud Scheduler -> PubSub -> Cloud Function-> external Service

and If I have a cron job for calling a service once a day, should I still need this pubsub in between?

I know there is an option for HTTP target type in Cloud Scheduler and I think the below setup without PubSub is good enough.

Cloud Scheduler -> Cloud Function-> external Service

Could you give some advice why I should/should not have the PubSub?

1 Answers

The example that you are looking at is Using Pub/Sub to trigger a Cloud Function so it'll include examples with Pub/Sub there. Instead you can deploy a HTTP Cloud function and use it's URL as the target URL as in below screenshot:

enter image description here

Here, Cloud Scheduler will trigger the function without Pub/Sub.

Related