Google Cloud Platform Overview
Google Cloud Platform (GCP) is one of the three major global cloud providers. Its Compute Engine offers flexible virtual machine instances. GCP's free tier includes one e2-micro instance, which can serve as a starting point for lightweight OpenClaw deployments. This article provides a detailed guide on deploying the OpenClaw AI Agent gateway on a GCE instance.
Prerequisites
- A Google Cloud account with billing enabled
- The gcloud CLI tool installed (or use Cloud Shell)
- Basic Linux command-line experience
Creating a Compute Engine Instance
Via gcloud CLI
If you have gcloud CLI installed locally, you can create an instance directly from the command line:
gcloud compute instances create openclaw-server \
--zone=asia-east1-b \
--machine-type=e2-small \
--image-family=ubuntu-2404-lts-amd64 \
--image-project=ubuntu-os-cloud \
--boot-disk-size=20GB \
--tags=http-server,https-server
This creates an e2-small instance (2 vCPU, 2GB RAM) in the Taiwan region running Ubuntu 24.04 LTS. For scenarios involving multiple chat platform connections and handling a high volume of messages, e2-medium (2 vCPU, 4GB RAM) or higher configurations are recommended.
Configuring Firewall Rules
Create a firewall rule for the OpenClaw Dashboard port:
gcloud compute firewall-rules create allow-openclaw \
--allow=tcp:3000 \
--target-tags=http-server \
--description="Allow OpenClaw Dashboard access"
Connecting to the Instance
Connect via SSH using the gcloud command:
gcloud compute ssh openclaw-server --zone=asia-east1-b
Alternatively, click the "SSH" button next to the instance in the GCP Console to connect through the browser's built-in terminal.
Installing Node.js 22
OpenClaw requires Node.js 22+. We use the official NodeSource repository for installation:
sudo apt update && sudo apt upgrade -y
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt install -y nodejs
Verify the installed version:
node --version
npm --version
Make sure the Node.js version is 22.x or higher. Do not use Bun as an alternative runtime, as it has known compatibility issues with WhatsApp and Telegram connections.
Installing OpenClaw
There are two installation methods to choose from.
Method 1: Global Installation via npm
sudo npm install -g openclaw@latest
Method 2: Via Official Installation Script
curl -fsSL https://openclaw.ai/install.sh | bash
Verify the installation:
openclaw --version
Initializing OpenClaw
Run the onboarding wizard to complete the initial setup:
openclaw onboard --install-daemon
The wizard will guide you through the following configuration steps:
- AI Model Configuration: Select and enter API keys for AI model providers (supports OpenAI, Anthropic, Google Gemini, etc.)
- Chat Platform Connections: Configure the chat applications you want to connect, such as WhatsApp, Telegram, Discord, etc.
- Daemon Installation: On Linux, a systemd service will be configured automatically
Configuration files are saved at ~/.openclaw/openclaw.json.
Configuring a systemd Service
If the onboarding wizard did not automatically create a systemd service, you can configure it manually. Create the service file:
sudo tee /etc/systemd/system/openclaw.service > /dev/null << 'EOF'
[Unit]
Description=OpenClaw AI Agent Gateway
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=your-username
ExecStart=/usr/bin/openclaw start
Restart=always
RestartSec=5
Environment=NODE_ENV=production
[Install]
WantedBy=multi-user.target
EOF
Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable openclaw
sudo systemctl start openclaw
Check the service status:
sudo systemctl status openclaw
Running Diagnostic Checks
Use OpenClaw's built-in diagnostic tool to confirm everything is working:
openclaw doctor
This command checks the Node.js version, configuration file integrity, network connectivity, and connection status of each chat platform. Make sure all checks pass.
Accessing the Management Dashboard
Start the Dashboard:
openclaw dashboard
Access http://your-external-IP:3000 in your browser to open the OpenClaw management dashboard. Here you can visually manage chat platform connections, view message logs, and configure AI model parameters.
Configuring HTTPS (Strongly Recommended)
HTTPS is strongly recommended for production environments. Install Nginx and Certbot:
sudo apt install -y nginx certbot python3-certbot-nginx
Create the Nginx configuration and obtain a certificate:
sudo tee /etc/nginx/sites-available/openclaw << 'EOF'
server {
server_name openclaw.yourdomain.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host $host;
}
}
EOF
sudo ln -s /etc/nginx/sites-available/openclaw /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d openclaw.yourdomain.com
Setting Up a Static External IP
By default, GCE instances use ephemeral external IPs, which may change after restarts. It is recommended to reserve a static IP:
gcloud compute addresses create openclaw-ip --region=asia-east1
gcloud compute instances delete-access-config openclaw-server --zone=asia-east1-b --access-config-name="External NAT"
gcloud compute instances add-access-config openclaw-server --zone=asia-east1-b --address=your-reserved-static-ip
Monitoring and Logging
GCP provides powerful Cloud Monitoring and Cloud Logging services. You can view instance CPU, memory, and network usage in the GCP Console. Additionally, OpenClaw's runtime logs can be viewed with:
journalctl -u openclaw -f
Cost Optimization Tips
For personal projects or small-scale use, the following strategies can help control costs:
- Use an e2-micro instance (included in the free tier) as a starting point
- Choose the region closest to you to reduce latency
- Set up budget alerts to avoid unexpected charges
- For fluctuating traffic, consider using preemptible instances to reduce costs
Summary
Google Cloud Compute Engine provides a stable and reliable runtime environment for OpenClaw. GCP has multiple data centers in the Asia-Pacific region, making it particularly friendly for users in China and Southeast Asia. With the configuration described in this tutorial, you can get a production-grade OpenClaw AI Agent gateway that stably connects various chat platforms and AI models.