Best way to keep high available single instance with external static IP on GCP

once in a while we need a single server for a specific purpose that won't get high traffic. For my scenario, this server requires a static external IP

I'm wondering what is the best way to have a high-available single server with static external IP on GCP?

Usually, we'd choose to create an instance-group with 1 minimal and 1 maximum instance, but that wouldn't keep the static IP for egress traffic after an instance crash/recreation. So, I'd have to create an instance-group with no external IP and make the egress traffic going through a NAT Gateway + a Load Balancer for another static IP for the ingress traffic.

The problem is, that sounds too much for a single server.

On AWS it can be achieved in an easier way. It's just:

  1. Launching one instance
  2. Associate an external IP address to it
  3. Create a Life cycle snapshot for backing up data
  4. Create alarm to restart or restore the instance in case of system or instance failure

So, my question is: Is there some easier way to achieve this on Google Cloud Platform?


Solution 1:

It is entirely possible to do in GCP what you're asking but it not easier. At least from the list of steps perspective.

Here's how you can do it:

  1. Reserve static public IP
  2. Create a VM with external IP from #1
  3. Create a Snapshot Schedule and attach it to a VM's persistent disk
  4. Create an uptime check and an alert that will publish it via pub/sub
  5. Create a GCP Scheduler job to restart desired VM based on pub/sub events.