google/cloud-functions-framework – Google Cloud Functions Framework for PHP

google/cloud-functions-framework is an open source FaaS (Function as a Service) Framework for writing portable PHP functions. An example function looks like this: <?php use Symfony\Component\HttpFoundation\Request; function helloHttp(Request $request) { return "Hello World from PHP HTTP function!" . PHP_EOL; } One can invoke it locally by executing the included router as follows: export FUNCTION_TARGET=helloHttp export FUNCTION_SIGNATURE_TYPE=http […]

Cloud Run vs App Engine: What’s the difference?

Simple and to the point article, with a few commands included, by Dirk Hoekstra: In a nutshell, you give Google’s Cloud Run a Docker container containing a webserver. Google will run this container and create an HTTP endpoint. With Google’s App Engine however you tell Google how your app should be run. The App Engine […]

Running the same Node.js code on Google Cloud Functions, App Engine, and Cloud Run

Google Cloud has a number of options to run your code. We can deploy a function to Cloud Functions, an app to App Engine, or an app with a custom runtime (a Docker container) to Cloud Run. In this post the same code snippet is deployed to all three Google Cloud Platform features. Locally the […]

Building a Website Screenshot API with Puppeteer and Google Cloud Functions

Here’s the source of a Google Cloud function that, using Puppeteer, takes a screenshot of a given website and store the resulting screenshot in a bucket on Google Cloud Storage: const puppeteer = require('puppeteer'); const { Storage } = require('@google-cloud/storage'); const GOOGLE_CLOUD_PROJECT_ID = "screenshotapi"; const BUCKET_NAME = "screenshot-api-net"; exports.run = async (req, res) => { […]

Today I Learned, the Google Cloud Platform / Terraform Edition

🌍 This week I’ve been goofing around with Google Cloud Platform and Terraform to manage it. I’ve learned quite a few things, that might be of help to others, so here goes … There’s a difference between IAM policy for service account (google_service_account_iam) and IAM policy for projects (google_project_iam_member). The former is used to allow […]

Secrets in Serverless

Good post on how and where to store your secrets when working in a Serverless / Cloud Environment — something I was wondering about myself a little while ago Serverless applications and cloud functions often need to communicate with an upstream API or service. Perhaps they require a username and password to connect to a […]

Google Cloud Platform Terraform Recipes

At work we’ve recently started to use Terraform to manage the cloud infrastructure of our clients. During my initial research on how to set up a Cloud SQL instance using Terraform, I stumbled upon the “Terraform Google Modules” organization (unaffiliated to Google). They provide several Terraform modules in order to easily create: A Kubernetes Engine […]