<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=2634489&amp;fmt=gif">

Infrastructure, Application Development, API Management, Getting Started with Google Cloud, Cloud Operations

Creating an API using Cloud Functions (Node.js)

By David Ressler | January 26, 2022

I am currently evaluating different Google Cloud products in trying to set up an API for developers to use in a mobile app.

 

How should I evaluate thinking between:

  • A single Cloud Function using Express.js to create multiple routes in an API (accessed via API Gateway), vs.
  • A single Cloud Function per API endpoint (accessed via API Gateway)

 

Best answer by yuval

Hello @davidressler 

Cloud Functions are based on Cloud Run. I like Cloud Run because you can build and run your own containers instead of having to think about supported environments in Cloud Functions.

Read “Getting started with API Gateway and Cloud Run”[1].

Regarding single Cloud Run service for multiple methods vs multiple Cloud Run services - consider resources usage by different methods, if you have a method that uses more memory or it is CPU intensive you might want to separate it to a different Cloud Run service with larger container size. You might want different scaling for different methods. You can also run each Cloud Run service using a separate service account with different roles - one service needs only permission to write to a specific GCS bucket and another needs permission to read a secret from Google Secret Manager.

 

[1] https://cloud.google.com/api-gateway/docs/get-started-cloud-run

 


Recent Articles

Google Cloud Strategy

AI Cheat Sheet

AI is no more and no less the drive to create robots with human minds so they can do everything we do and more. Use this cheat sheet to help decode the space.
By Leah Zitter
AI and Machine Learning

CarCast with Bruno Aziza: What Makes Us Better Than AI?!

Unlock the secrets of human cognitive superiority over AI in this compelling CarCast with Bruno Aziza and Kenneth Cukier.
By Bruno Aziza
AI and Machine Learning

CarCast with Bruno Aziza: The Metrics You CAN'T Afford To ...

Discover essential CEO metrics: Rule of 40, CAC Ratio, NRR/GRR, and more. Optimize your business for success now!
By Bruno Aziza