Skip to main content

GCP Supported Services

NightOps supports automated start/stop management for the following Google Cloud Platform services. These services can be safely turned off and restored without requiring manual reconfiguration.

Supported Services Overview

ServiceStop MethodStart MethodData PreservedConfig Preserved
Compute EngineStop InstanceStart Instance
Cloud SQLStop InstanceStart Instance
Cloud RunScale to 0Restore InstancesN/A
GKE Node PoolsScale to 0Restore Size✅ (with PD)

Compute Engine

Compute Engine VM instances can be stopped and started without losing configuration or persistent disk data.

API Operations

OperationAPI CallDescription
Listinstances.listList all instances in a zone
Stopinstances.stopStop a running instance
Startinstances.startStart a stopped instance
Statusinstances.getCheck instance status

What's Preserved

  • ✅ Persistent disks and data
  • ✅ Network configuration
  • ✅ Service account
  • ✅ Internal IP address
  • ✅ Metadata and labels
  • ✅ Machine type configuration

Caveats

External IP Changes

Ephemeral external IPs change on restart. Use static external IPs if a fixed IP is required.

Local SSD

Local SSD data is lost when an instance stops. Only persistent disk data is retained.

Preemptible/Spot VMs

Preemptible and Spot VMs cannot be stopped, only deleted and recreated.


Cloud SQL

Cloud SQL database instances can be stopped and started, preserving all data and configuration.

API Operations

OperationAPI CallDescription
Listinstances.listList all Cloud SQL instances
Stopinstances.patch (activationPolicy: NEVER)Stop a database instance
Startinstances.patch (activationPolicy: ALWAYS)Start a database instance
Statusinstances.getCheck instance status

What's Preserved

  • ✅ All data
  • ✅ Database configuration
  • ✅ Connection name
  • ✅ Private IP configuration
  • ✅ Automated backups configuration
  • ✅ Maintenance windows

Caveats

Activation Policy

Cloud SQL uses activationPolicy to control instance state. Setting to NEVER stops the instance, ALWAYS starts it.

High Availability

Stopping a High Availability instance also stops the standby. Both resume together.

Read Replicas

Read replicas must be stopped separately from their primary instance.


Cloud Run

Cloud Run services can be scaled to zero instances and restored to their previous configuration.

API Operations

OperationAPI CallDescription
Listservices.listList all Cloud Run services
Stopservices.patch (minInstances: 0, maxInstances: 0)Scale to zero
Startservices.patch (restore min/max)Restore instance count
Statusservices.getCheck service status

What's Preserved

  • ✅ Container configuration
  • ✅ Environment variables
  • ✅ Service account
  • ✅ VPC connector
  • ✅ Domain mappings
  • ✅ Traffic configuration

Caveats

Cold Start

When scaled to zero, the first request after restoration will experience a cold start delay.

Minimum Instances

NightOps stores the original minInstances value before scaling to zero for accurate restoration.


GKE Node Pools

GKE managed node pools can be scaled to zero nodes while preserving cluster configuration.

API Operations

OperationAPI CallDescription
Listprojects.locations.clusters.nodePools.listList all node pools
Stopprojects.locations.clusters.nodePools.setSize (nodeCount: 0)Scale to zero
Startprojects.locations.clusters.nodePools.setSize (restore)Restore node count
Statusprojects.locations.clusters.nodePools.getCheck node pool status

What's Preserved

  • ✅ Node pool configuration
  • ✅ Node image and machine type
  • ✅ Service account
  • ✅ Network tags
  • ✅ Kubernetes labels and taints
  • ✅ Autoscaling configuration

Caveats

Control Plane Cost

The GKE control plane (Autopilot or Standard) still incurs cost even with zero nodes.

Stateful Workloads

Stateful workloads need PersistentVolumeClaims backed by Persistent Disks to retain data.

Scale-Up Time

Scale-up takes 2-5 minutes for nodes to become ready and pods to be scheduled.


Unsupported Services

The following services cannot be safely automated without manual intervention:

ServiceReason
MemorystoreNo stop functionality; delete loses data
Cloud SpannerNo stop; scaling to 0 nodes not allowed
DataflowJobs must complete or be cancelled
Cloud ComposerEnvironment stop requires full recreation
FilestoreNo stop functionality; delete loses data

Resource Labeling

For NightOps to manage resources, apply these labels:

nightops-managed: true
nightops-schedule: <schedule-id>
nightops-environment: staging | development | testing

Label-Based Filtering Example

// List only NightOps-managed Compute instances
const instances = await computeService.list({
managedOnly: true,
scheduleId: "schedule-123"
});

Multi-Project Support

NightOps supports managing resources across multiple GCP projects using service account impersonation.

Architecture

┌─────────────────┐         ┌─────────────────┐
│ Hub Project │ │ Spoke Project │
│ (NightOps) │────────▶│ (Customer) │
│ │ Impersonate│ │
└─────────────────┘ └─────────────────┘

Setup Requirements

  1. Create a service account in each spoke project
  2. Grant the NightOps service account permission to impersonate
  3. Assign required IAM roles (see GCP IAM Policy Reference)
// Cross-project access
const compute = new ComputeService({
projectId: "spoke-project-id",
impersonateServiceAccount: "nightops@spoke-project.iam.gserviceaccount.com"
});

Next Steps