In this article, we will tell you the steps you need to set up Google Cloud Function for IronWorker.

1. Enable Cloud Function API

First, we need to enable Cloud Function API. Go to “APIs & Services” From the left menu, click “Dashboard.”

gcp_1

Click on the “Enable APIS And Services” Button.

gcp_2

Now Search for “cloud functions” and select “Cloud Functions API” from the results.

gcp_3

Finally, click the “Enable” button.

gcp_4

You will be able to see API Dashboard after it’s being enabled.

gcp_5

2. Create a Cloud Function

Form GCP Left Services Menu select “Cloud Functions.”

gcp_6

The first time it will show a prompt, click on “Create Function”

gcp_7

Enter your function name, select the region, and set the way you want to trigger the function from “Trigger Type”.

Your Cloud Function can be triggered from different GCP services listed below in the following image, such as Pub/Sub, where it can be the worker for a Message-Queue, or it can be invoked using HTTP URL.

gcp_9

In the advanced section, you can set memory, timeout, and function environment variables.

gcp_10

Click “save” on the Trigger options section first to be able to deploy the function. Copy the “URL” to use in invoking the function

gcp_8_

After deploying the function initial screen will show:

- Runtime options: Supported runtime languages
- Entry point: The function name in your code that will run on the cloud function triggered
- Source Code: You can use the inline Editor or upload Zip package code.

then click “deploy”.

gcp_11

3. Limits

Main Google Cloud Function limits are :

Max number of functions that can be deployed per region: 1000
Max deployment size : 100MB Compressed - 500MB uncompressed
Max function memory: 4096MB

4. Costs

Your charges will be based on million Invocations, CPU, and memory, Network Egress.

GCP

More on Google Function pricing here:

https://cloud.google.com/functions/pricing

5. Notes

Cloud Function provides a fast and way to deploy your serverless functions, requires an additional step to configure the security as part of GCP APIs, and provides a variety of runtimes.

Can be triggered by an HTTP Trigger, or Other GCP services, provides a fair web debugging console

7. Pros & Cons

Cloud Function Pros are the ease of setup, ease of integration with firebase and other GCP components e.g. GCP Pub/Sub. Comparing to other solutions it’s the only one FaaS with “Go Language” Runtime supported.

Doesn’t come with a scheduler like in IronWorker and it’s a FaaS solution with limitations on runtime unlike IronWorker a CaaS solution.

Google Cloud functions can be scheduled using “Google Cloud Scheduler”, GCP Pub/Sub more on scheduling here https://cloud.google.com/scheduler/docs/tut-pub-sub

Leave a Comment





This site uses Akismet to reduce spam. Learn how your comment data is processed.