How To Google Cloud Functions? Best Practices Serie

Beranger Natanelic
Google Cloud - Community
3 min readFeb 20, 2023


A 4 articles serie of real-life advices using Google Cloud Functions

In this serie, I give various advices about Google Cloud Functions development. This work is a result of two years of daily practice, deployment and monitoring. Some of these best practices are directly from the official documentation, others are from my experience, what was proven to be the most effective. For any different point of view, feel free to comment this (free) article.

Although this serie needed more than a week to be written and pictured, it is not complete, it’s missing testing good practices, for instance… To really have a full overview of the best practices after reading the serie, check the official documentation, the release note periodically and stay tuned.

Although these articles were read by thousands of people, only a very few have an account and even fewer clap it. If this serie was a minimum useful, clap or comment, it’s motivating to keep going!


1/4. Get the environment ready

To start with solid foundations, it’s important to have the correct structure, ready to scale. It’s even more important to use the right tools and the right development process even before deploying a single Cloud Function.

After reading this article, we will save hours, have a clearer structure, ready to deploy multiple functions in multiple languages efficiently.

2/4. Optimise the Cloud Functions

Once the environment is ready, development and deployment is so easy that it’s tempting to deploy multiple Functions, that have common code.

In this second part, we will see how we could split our code efficiently. I will also show how to use the function cache (yes, there is cache in serverless!). Last but not least, I am having a deep look into Min instances and Max instances features.

3/4. Secure the Cloud Functions

With efficient Cloud Functions running, it’s essential to keep them safe and protect them.

Now, we will have a deep look into Cloud Functions permissions, into security differences between background functions, oauth authentication and API key authentication.

I give various advices about rate limiting, secret management and, one of the most ignored-by-users part (for me) of this serie => packages management.

4/4. Monitor and log the executions

Fiuu, we made it until here! We developed secured Functions efficiently, it’s now running fast with minimum cold starts time!

Now what?

Now, we are blind, we don’t know if it went well, if it crashed. To have metrics, notifications, a deep vision inside the executions while staying outside, we need to set up monitoring tools and log efficiently.

We learn that in the last episode:



Beranger Natanelic
Google Cloud - Community

Daily Google Cloud Platform user. I am sharing learnings of my tries, struggle and success.