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 … IAM for SA vs. IAM for Projects There’s a difference between IAM policy for service account (google_service_account_iam) and IAM policy for projects …

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 …