Deploying to: Google Cloud Platform

For my new project, I’ve been building a production environment that is easy to set up and fast to scale.

I’ve worked with cloud since 2015, mainly with AWS. It’s the oldest and has the oddest service names.

AWS Glue, Snowmobile, Honeycode, Fargate, Elastic Beanstalk … yeah.

When I need something simple, I go for a Linode VPC.

But that won’t do here.

I want zero-hassle scaling, so after looking for advice, I gave Google Cloud Platform a go.

For context, the API is written in Go, works mainly with Redis for stateless horizontal scaling, uses Postgres for persistence, and is built into a Docker container.

I’m two days into the Google experiment. Here are my impressions.

Clear user interface

The naming makes sense. The database is just SQL, and Redis is Redis. They are easy to find in the console.

The user interface is also clean, and I had no problems searching for what I needed.

The stack

I set up the first few things through the console.

Postgres. Check. ✔️ Redis. Check. ✔️ VPC. Check. ✔️

Then came the deployment. I created a Docker container and made it stateless on purpose so that I could use Google Cloud Run, their pay-per-use serverless platform.

Cloud Run takes in either a function or a Docker container and creates a service that automatically scales with traffic. No load balancing is needed; it just works.

This is conceptually similar to AWS Fargate on ECS. Obviously.

Let’s build a deployment pipeline.

GitHub Actions

I used the Google deployment file and modified it to meet my needs. I sorted out the required IAM permissions, which was a slight hassle, but permissions always are.

Luckily, the error messages were clear on what was missing.

The main issue I then had was passing all the secrets from the environment and the secret store. However, the logs told me what had broken, so I never felt that it didn’t work, and I had to wonder why.

The power of the CLI

I’ve used AWS CLI before, and let me tell you, it will make you cry.

Which would you instead use to get the external IP of a specified VM?

aws ec2 describe-instances --filters "Name=tag:Name,Values=INSTANCE_NAME" --query "Reservations[].Instances[].NetworkInterfaces[0].Association.PublicIp" --output text

or

gcloud compute instances describe INSTANCE_NAME --format="get(networkInterfaces[0].accessConfigs[0].natIP)"

No crazy filtering; everything has a name, and the API is concise. I got the hang of it in a few hours, breezing along.

To speed myself up, I used official docs, piped examples into Cline, and got it to generate and run the commands.

Even the IAM permissions for the GitHub Actions <> GCP were easy enough to fix by cline transforming the error messages into IAM permission add requests.

Day 2: API Gateway

You could theoretically allow public access to your Cloud Run service, but I prefer to do it properly. I defined an API and gateway to expose the service on a public URL.

That way, I can do rate limiting, auth, and have logs in a centralized place.

Final thoughts

It’s still early days with this, and it will be fun once we start getting traffic, but I’m already happy with the setup.

It’s clear, it was easy to set up, and it just works.

That’s what I need from the start—automated, hassle-free deployments to a scalable platform without requiring a full-time infrastructure engineer.

Once I can afford one or two, we can move to Kubernetes and optimize further. Until then, if serverless becomes expensive, that will be a good problem.

Because load means users and users generate cash.

Yours,

Taj

All writing