Skip to content
Tech Blog
Go back

Deploy OpenClaw on Huawei Cloud ECS and Use Huawei ModelArts MaaS (OpenAI-Compatible)

Edit page

TL;DR


1) Reference Architecture

Single-node, production-like (recommended baseline):

Data flow:

Telegram/WhatsApp → OpenClaw Gateway → LLM (Huawei MaaS) + Tools (shell/files/browser/cron) → Reply


2) Why ECS + MaaS is a good pairing


3) Prerequisites

3.1 ECS sizing

Baseline for an always-on agent:

3.2 Network / Security Group

Minimum:

Optional (only if you expose a dashboard/UI):

3.3 System packages

Ubuntu example:

sudo apt-get update
sudo apt-get install -y curl git jq

4) Step-by-step: Install & start OpenClaw on ECS

Install method can vary (package manager vs binary vs container). The key is: OpenClaw CLI is available, and Gateway can run continuously.

4.1 Create a dedicated workspace

sudo mkdir -p /mnt/data/clawd
sudo chown -R $USER:$USER /mnt/data/clawd
cd /mnt/data/clawd

Recommended structure:

/mnt/data/clawd/
  MEMORY.md
  memory/
  scripts/
  insights/

4.2 Verify OpenClaw CLI

openclaw help

4.3 Start Gateway and confirm health

openclaw gateway status
openclaw gateway start
openclaw gateway status

If you change config later:

openclaw gateway restart

5) Step-by-step: Configure Huawei ModelArts MaaS (OpenAI-Compatible)

Huawei’s own best-practice guide for using MaaS with a client (Cline) documents the key idea:

Source: Huawei Cloud ModelArts Studio (MaaS) best practice (DeepSeek + Cline).

5.1 Create MaaS API key

In ModelArts Studio (MaaS) console:

5.2 Deploy / select a MaaS real-time inference service

In MaaS console:

Then for the running service:

5.3 Set OpenAI-compatible variables (example)

Use placeholders because endpoint shapes vary by tenant/region:

export HUAWEI_MAAS_API_KEY="<YOUR_MAAS_KEY>"
export HUAWEI_MAAS_API_URL="https://<...>/v1/chat/completions"   # from MaaS call description
export HUAWEI_MAAS_BASE_URL="${HUAWEI_MAAS_API_URL%/chat/completions}"  # remove suffix
export HUAWEI_MAAS_MODEL_ID="<MODEL_ID_FROM_MAAS>"

5.4 Sanity check from ECS (curl)

curl -sS "$HUAWEI_MAAS_BASE_URL/chat/completions" \
  -H "Authorization: Bearer $HUAWEI_MAAS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "'"$HUAWEI_MAAS_MODEL_ID"'",
    "messages": [{"role":"user","content":"Hello from Huawei ECS"}],
    "temperature": 0.2,
    "max_tokens": 128
  }' | jq

If this works, your ECS outbound network + MaaS credentials are good.


6) Step-by-step: Wire OpenClaw to MaaS

OpenClaw is model-agnostic. The practical target is:

Where you set these depends on how your OpenClaw deployment is configured (config file vs environment variables). A safe operational pattern is:

Example (conceptual):

OPENAI_COMPAT_BASE_URL=https://<HUAWEI_MAAS_OPENAI_ENDPOINT>/v1
OPENAI_COMPAT_API_KEY=<YOUR_KEY>
OPENAI_COMPAT_MODEL=<MODEL_ID>

Tip: start by validating MaaS with curl first; only then integrate into OpenClaw. It reduces debugging surface area.


7) Validation: Messaging + cron automation (production sanity)

7.1 Confirm Gateway is up

openclaw gateway status

7.2 Confirm you can send/receive a Telegram message

Send a message to your bot and confirm:

7.3 Add a cron job (cron runs inside Gateway)

OpenClaw cron jobs are persisted on the Gateway host and survive restarts.

You can create a one-shot reminder:

openclaw cron add \
  --name "ECS smoke test" \
  --at "5m" \
  --session main \
  --system-event "Reminder: OpenClaw on ECS is running. Check MaaS connectivity." \
  --wake now \
  --delete-after-run

List jobs:

openclaw cron list

Reference: OpenClaw cron docs.


8) Operational pattern: Health checks + failure thresholds

In real deployments, the important question is not “does it work once?” but “does it keep working?”

A lightweight pattern:

This is the same pattern used in my own workspace for Telegram health monitoring.


9) Security hardening checklist


10) Common pitfalls (and how to fix them)

Pitfall A: Cron doesn’t run

Check:

openclaw gateway status

Pitfall B: MaaS “OpenAI compatible” fails

Common causes:

Fix: re-test with curl (Section 5.4) before blaming OpenClaw.

Pitfall C: Costs creep up

Cron + agents can silently increase token usage.

Mitigations:


References


Edit page
Share this post on:

Previous Post
Deploying a Qwen3-VL OpenAI-Compatible API on Huawei Cloud Ascend (910B) with Docker + FastAPI
Next Post
Runbook: Deploy Dify + RAG on Huawei Cloud ECS (Docker Compose)