How to Deploy Openclaw on GCP Compute Engine

Image
Table of contents: [Show]

Quick Start

Deploy Openclaw on Google Cloud Platform (GCP) Compute Engine to create a scalable, production-ready AI gateway. This guide walks you through creating a VM, installing Openclaw, and configuring it for remote access.

Openclaw GCP

Create the GCP Project and VM

If you are using the gcloud CLI, authenticate and create your project:

gcloud projects create my-openclaw-project --name="Openclaw Gateway" gcloud config set project my-openclaw-project gcloud services enable compute.googleapis.com

Next, create an e2-small Debian 12 VM:

gcloud compute instances create openclaw-gateway --zone=us-central1-a --machine-type=e2-small --boot-disk-size=20GB --image-family=debian-12 --image-project=debian-cloud

Install Openclaw on the VM

SSH into your instance and install Openclaw:

gcloud compute ssh openclaw-gateway --zone=us-central1-a

Once connected, run the installer:

curl -fsSL https://openclaw.ai/install.sh | bash

Configure Firewall Rules

Allow external access to Openclaw's default port:

gcloud compute firewall-rules create allow-openclaw --allow tcp:8080 --source-ranges=0.0.0.0/0 --description="Allow Openclaw gateway access"

If you're also using Hetzner or other VPS providers, the configuration pattern remains similar across cloud platforms.

Set Up Openclaw Configuration

Create your configuration file:

mkdir -p ~/.openclaw nano ~/.openclaw/openclaw.json

Add your channel and model settings. For a quick test with Ollama models:

{ "agents": { "defaults": { "model": { "primary": "ollama/llama3.2" } } } }

Start the Gateway

Launch Openclaw as a background service:

openclaw gateway start --daemon

Verify it's running:

openclaw gateway status

Connect to Your Gateway

Get your VM's external IP:

gcloud compute instances describe openclaw-gateway --zone=us-central1-a --format='get(networkInterfaces[0].accessConfigs[0].natIP)'

Configure your local Openclaw CLI to connect:

openclaw config set gateway.url http://YOUR_VM_IP:8080

Troubleshooting

  • Connection refused: Verify the firewall rule allows port 8080 and Openclaw is running.
  • Permission denied: Ensure you're using the correct SSH key or configure OS Login.
  • Out of memory: Upgrade to e2-medium if running multiple models.

Your Openclaw gateway is now live on GCP. Connect your preferred channels and start routing AI conversations through your self-hosted infrastructure.