Free Functions in Cloud

Gonzalo Galante
3 min readFeb 1, 2023

--

For those of us who program or like to design our own features to use, such as a bot that gives us the current weather when we consult it via telegram or whatsapp, we know that having this on a local server is cumbersome, impractical, and with the added bonus that if it is The network goes down or there is a power cut, we will not have more accesses.

This is why the cloud is the best solution if it were not for the inconvenience of the costs that it implies, and for small projects, especially personal ones, or even for studies, it makes it a barrier.

But Google and its Cloud Functions come to save the day, with its great free layer which, if we know how to take advantage of it, will give us more than enough to build our functionalities in the cloud, free, securely and with so much margin that we can even share it. to other users.

What is free?

As I mentioned in my article on how to use the cloud for free, Google Cloud Functions has a free tier which includes the following features.

  • 2 million invocations per month (includes HTTP and background invocations)
  • 400,000 GB-second, 200,000 GHz-second processing time
  • 5 GB of network egress per month

More details about this
https://cloud.google.com/functions/pricing?hl=es-419

How to use them?

Once in the GCP console we must go to the Cloud Functions module, here it will ask us to activate the necessary APIs to use it in case they are not active.

Once here we will go to “Create Function”

We can use the first or second generation functions, the difference between one and the other lies in theConcurrency, Event Sources, Execution Time, Available Regions, y Traffic Management.

We can select “Allow unauthenticated invocations” if we want to make our function public, for practices or something private I recommend leaving it in “Require authentication” and in any case if we want to share it, authorize those people.

In this section we can change the memory assigned to our function, the auto scaling and the timeout which means that if the function is not completed within that time it will automatically end.

Once we press next it will take us to the coding section, there we can select the language in which we will program and generate more files than those that come by default, which are the main and the requirements.

We can also change the source of the code, that is, we can write it right there or bring it from a local ZIP, one stored in Cloud Storage or even from the Cloud Source Repository.

Once this is set upWe will press deploy and we will have our function available, to which we can make the request through HTTP.

Within the interface we will be able to see everything that influences our functions, from performance metrics, logs, permissions, environment variables if we have them, and the source code.

To obtain the URL we must go to the Trigger tab.

--

--