• Skip to primary navigation
  • Skip to main content
Last Week in AWS Logo
Master your cloud costs
  • About
    • Community
    • Contact
  • Blog
  • Newsletter
  • Podcasts
    • Last Week in AWS Podcast
    • Screaming in the Cloud
    • Nominate a Guest
  • Merch
  • Resources
    • AWS Network Map
09.14.2022

Google Cloud Functions Is Surprisingly Delightful

By Corey Quinn
I’ve been beating Azure up a fair bit lately, which is no great surprise to anyone who’s a regular reader of this publication. A friend of mine mentioned over drinks that she…
FacebookXLinkedInReddit
Home Blog Google Cloud Functions Is Surprisingly Delightful
Prev
Next

I’ve been beating Azure up a fair bit lately, which is no great surprise to anyone who’s a regular reader of this publication. A friend of mine mentioned over drinks that she thinks of Azure as “the Boomer cloud,” at which point I spat my own drink out and immediately knew what I had to do:

Build something on Google Cloud Functions. To the Google Cloud console I go!

I think of Google Cloud Functions more or less as “AWS Lambda with Google branding.” That’s my baseline starting point. Unlike AWS, which hurls you into a morass of options that assumes you know what you’re doing, the wizard that Google Cloud offers is pretty straightforward. It starts by asking whether I want to use the 1st generation or 2nd generation function options.

What is this

A quick perusal of the differences shows me that this is pretty typical for a Google offering; generation 1 is deprecated while generation 2 is in beta. Given that I’m a sysadmin historically, I bias for “old and busted” over “new hotness,” so generation 1 it is.

Next, it asks me what to call it (which is easy since I’m not about to delegate naming anything to a cloud provider based solely upon its track record of screwing that particular thing up). It also asks me which region to put this in, which I absolutely do not care about in the slightest, so I accept the default on the theory that they wouldn’t suggest something currently on fire.

The next thing it cares about is the trigger for the function invocation. I’m met with eight potential options, four of which are marked “PREVIEW” in the drop-down menu.

I'm just an intern

At this point, I want a function that’s going to fire off every five minutes or so, and none of the various options presented seem to grant that. A bit of googling shows that Google has taken a page from AWS’s playbook on this: The right approach is to set up a job in Google Cloud Scheduler to fire every five minutes. It will then toss a message onto a Google Pub/Sub queue, which can be consumed as a Cloud Function trigger.

I admit, I cringed at this. AWS has taught me that whenever you have to cross service team boundaries like this, the experience is going to absolutely suck for you. I was therefore thrilled to learn that apparently Google doesn’t have internal policies against one service team talking to another service team every once in a while, and all of this took a few clicks in the console to set up.

This looks familiar I think

I accept the defaults for the rest of this and move on to the code portion. I’m greeted immediately by a boilerplate skeleton of a function and a dropdown of which language runtime I want to use.

There are a sarcastic number of options, so I went with the Python 3.10 option.

Nevermind.

At this point, the infrastructure is basically set; it’s time for me to write some crappy Python to make all of this do something useful.

That didn’t take very long to bang out, because what I want is relatively simple. Whenever Microsoft Azure’s Twitter account tweets something that isn’t a retweet or a reply, I want the function to trigger my bot to quote-tweet Azure’s tweet in all caps along with the kind of commentary that you’d generally expect from what appears to be Azure’s target market.

I stored the Twitter API credentials in the Google Cloud Function’s environment variables section, but then I was left with a problem: Once this horrible bot has tweeted about an Azure tweet, I don’t want it to tweet that again. Where do I store the single piece of state for this entire application, the ID of the last tweet it saw?

This is a deceptively complex problem, and none of the cloud providers have a differentiated answer for this. Every option I explore requires at least one of two things: I either have to set up a whole means of accessing a different subsystem to retrieve the tweet ID, and/or I have to store API credentials for a third-party service to hold that data itself.

One horrible idea that occurs to me is to use a second Twitter account as a database and simply have it tweet out the ID in question. After all, I already have the Tweepy libraries integrated. I dismissed this idea as nearly as deranged as using Route 53 as a database and opted instead for Google’s Cloud Firestore option. This is a NoSQL document database that does an awful lot of stuff I really could not care less about, but it also takes a key and returns a value — which is all I really want.

The shining jewel here is that because both Firestore and my Cloud Function are in the same Google Cloud project, by default the security permissions just worked without me having to strike a deal with the devil. I wasn’t expecting that and am absolutely enchanted by the experience.

The unsolved problem as of this writing remains that I haven’t gotten Google Cloud Repositories to properly sync from my GitHub repository correctly, so I’m reduced to copying and pasting code in like some kind of monster from 1998.

But all things considered, it was a delightful development experience that I’d absolutely recommend to someone who’s starting out.

And if you care about what Azure is doing, you should absolutely keep up with the antics of my @CloudBoomer bot account which, if you’ve gotten this far with my nonsense, will no doubt tickle you.

Corey Quinn Headshot
by Corey Quinn

Corey is the Chief Cloud Economist at Duckbill, where he specializes in helping companies improve their AWS bills by making them smaller and less horrifying. He also hosts the "Screaming in the Cloud" and "AWS Morning Brief" podcasts; and curates "Last Week in AWS," a weekly newsletter summarizing the latest in AWS news, blogs, and tools, sprinkled with snark and thoughtful analysis in roughly equal measure.

More Posts from Corey

Back to the Blog

Infinidash: AWS’s New Observability Play Has Great Bones and a Terrible Bedside Manner

By Corey Quinn

Infinidash: AWS’s New Observability Play Has Great Bones and a Terrible Bedside Manner AWS has just released something fascinating in the form of CloudWatch Omni. I want to be upfront before I dive further: “CloudWatch Omni” is a wretched name that I will not be using, so for the rest of this article and the […]

Read Moreabout Infinidash: AWS’s New Observability Play Has Great Bones and a Terrible Bedside Manner

Reading Observability Tools? That’s a Robot’s Job

By Corey Quinn

Last Thursday Honeycomb was kind enough to hand me the closing keynote slot at O11yCon, a conference whose entire premise is that observability matters and the people in the room are the ones who would know. I used that slot to argue that the primary reader of your telemetry is no longer a human, and […]

Read Moreabout Reading Observability Tools? That’s a Robot’s Job

S3 Is Not a Filesystem (But Now There’s One In Front of It)

By Corey Quinn

I’ve been saying “S3 is not a filesystem” for over a decade. I’ve said it on stages, in newsletters, on podcasts, and directly to the faces of large company employees who were too polite to tell me to shut up before they went back to their FUSE monstrosities. It was one of those reliable truths […]

Read Moreabout S3 Is Not a Filesystem (But Now There’s One In Front of It)
Billie Holding Mail Email Subscribe Icon

Get the newsletter!

Stay up to date on the latest AWS news, opinions, and tools, all lovingly sprinkled with a bit of snark.

You’re faced with tough questions about cloud costs. You should have confident answers.
Get in touch.
  • Newsletter
  • Podcasts
  • Blog
  • Merch
  • About
  • Contact
  • Disclosures
Billie Footer
footprint-orange
© 2026 L9 Labs, Inc. All Rights Reserved.
Terms of Service Privacy Policy Cookie Policy