Setting Up Your Own Personal AI Agent with OpenClaw (EC2 + Telegram + GitHub Copilot)

 

In 2026, the era of the static chatbot is over. We have entered the age of Agentic AI — personal assistants that don't just talk, but actually work for you. They read your files, run shell commands, manage your schedule, and deploy your code — all while you message them from your phone.

Among the tools leading this revolution, OpenClaw has emerged as the most powerful open-source framework for building an always-on, private AI assistant. It gained over 100,000 GitHub stars in under a week after its launch, making it one of the fastest-growing open-source projects in GitHub history.

In this hands-on guide, we'll walk you through setting up your own OpenClaw instance on an Amazon EC2 Free Tier server, connecting it to Telegram for 24/7 mobile access, and powering it with GitHub Copilot as the AI model provider — all for about $10/month.

This isn't a theoretical overview. I've done this setup myself and will share my first-hand observations, gotchas, and practical tips along the way.


What You'll Need Before Starting

Before you begin, make sure you have these ready:

  • An AWS account — sign up at aws.amazon.com if you don't have one. The Free Tier is available immediately
  • A GitHub account with Copilot Pro ($10/month) — this provides the AI models. If you don't have Copilot yet, sign up at github.com/features/copilot
  • The Telegram app installed on your phone or desktop
  • Basic comfort with the terminal — you'll be running commands over SSH, but everything is copy-paste friendly

The entire setup takes about 20-30 minutes from start to finish.


What is OpenClaw?

OpenClaw (formerly ClawdBot, then MoltBot) is an open-source "agent runtime" and message router created by Peter Steinberger. Unlike ChatGPT which sits behind a website, OpenClaw lives on your server and acts as a true AI agent that can:

  • Access your filesystem — read, write, and edit files directly on the host machine
  • Execute shell commands — run scripts, manage cron jobs, deploy applications
  • Connect to 12+ messaging platforms — route conversations through Telegram, Slack, Discord, WhatsApp, Signal, and more
  • Expand via Skills — add capabilities like web search, weather, database management, or custom automations
  • Work autonomously — a heartbeat scheduler can wake it at configurable intervals for unprompted task execution
  • Control a browser — automate web interactions via a dedicated Chrome/Chromium instance

Think of it as having a junior developer on your server 24/7, reachable from your phone.


The Setup Architecture

Here's what we're building:

┌─────────────┐     Telegram Bot API      ┌──────────────────┐
│  Your Phone  │ ◄────────────────────────► │   Amazon EC2     │
│  (Telegram)  │                            │   (t3.micro)     │
└─────────────┘                            │                  │
                                           │  ┌────────────┐  │
                                           │  │  OpenClaw   │  │
                                           │  │  Gateway    │  │
                                           │  └─────┬──────┘  │
                                           │        │         │
                                           │  ┌─────▼──────┐  │
                                           │  │  GitHub     │  │
                                           │  │  Copilot    │  │
                                           │  │  (AI Model) │  │
                                           │  └────────────┘  │
                                           └──────────────────┘
Component Choice Why
Host Amazon EC2 (t3.micro / t2.micro) 12 months free tier with ~$90 in credits
Interface Telegram Free, encrypted, works on all devices
AI Brain GitHub Copilot (Gemini 3 Flash) Multiple model choices, 300 premium requests
Total Monthly Cost ~$10.00 AWS Free Tier + GitHub Copilot Pro subscription

First-Hand Tip: Don't Start with a Mac Mini

If you're excited about OpenClaw and thinking about buying a Mac Mini or dedicated hardware to run it — don't. At least not yet.

I made this evaluation myself. The temptation is real because OpenClaw has a beautiful macOS companion app. But here's the reality: a Mac Mini M4 costs $500+ and you don't know yet if OpenClaw fits your workflow.

Start with a VPS instead. The best option is Amazon EC2 because:

  • It's free for 12 months with approximately $90 worth of free compute credits
  • A t3.micro instance (1 vCPU, 1 GB RAM) is sufficient for getting started with OpenClaw
  • You can scale up later if you need more power
  • If you decide OpenClaw isn't for you, your only cost was the Copilot subscription you probably already had

Once you've used OpenClaw for a few weeks and know it's valuable to you, then consider dedicated hardware. But EC2 gets you to production in 15 minutes at zero cost.

If you're new to AWS and want a visual walkthrough of setting up an EC2 instance, check out this video: How to Setup Amazon EC2. This is not a sponsored recommendation — we just found the instructions in this video to be absolutely to the point and accurate, so we're recommending it.


Step 1: Launch Your AWS EC2 Instance

1.1 Create an AWS Account

If you don't have one yet, sign up at aws.amazon.com. The Free Tier starts immediately upon account creation and lasts 12 months.

1.2 Launch the Instance

  1. Go to the EC2 Dashboard → Click Launch Instance
  2. Name: Give it something memorable like openclaw-agent
  3. AMI: Choose Ubuntu 24.04 LTS (HVM, SSD Volume Type)
  4. Instance Type: Select t3.micro (1 vCPU, 1 GiB RAM) — this is Free Tier eligible
  5. Key Pair: Create a new key pair or select existing. Download the .pem file and keep it safe
  6. Network Settings:
    - Allow SSH traffic (port 22) from your IP
    - That's it — OpenClaw doesn't need any other inbound ports open because Telegram uses outbound long-polling
  7. Storage: 25 GB gp3 (the free tier allows up to 30 GB)
  8. Click Launch Instance

Pro Tip: Set Up a Billing Alert

If this is your first time using AWS, set up a billing alert so you're never surprised by charges:

  1. Go to AWS Billing DashboardBudgetsCreate Budget
  2. Choose Zero spend budget — this alerts you the moment any charge appears outside the Free Tier
  3. Enter your email and create the budget

This takes 30 seconds and gives you peace of mind. AWS Free Tier covers a t3.micro for 12 months, but if you accidentally leave a larger instance running or exceed storage limits, you'll know immediately.

1.3 Connect to Your Instance

No SSH setup needed. Simply go to your EC2 instance in the AWS console, select the instance, and click the Connect button at the top. On the next page, click Connect again. This opens a terminal window right in your browser — you can start pasting commands immediately.


Step 2: Install OpenClaw

Run the official one-line installer:

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

This automatically detects your OS, installs all required dependencies (including Node.js 22+), downloads the latest OpenClaw release, and launches the onboarding wizard. You don't need to install Node.js separately.

Run the Onboarding Wizard

openclaw onboard --install-daemon

The interactive wizard will walk you through:

  1. Security notice — confirm you understand OpenClaw can execute commands on your system
  2. AI model provider selection — we'll choose GitHub Copilot (you can skip this and configure it in the next step)
  3. Channel configuration — we'll set up Telegram shortly
  4. Skills configuration — select "npm" as your node package manager
  5. Optional API keys — for services like web search, weather, etc.

The --install-daemon flag is important — it creates a systemd service so OpenClaw survives SSH disconnections and system reboots.


Step 3: Connect GitHub Copilot (The AI Brain)

Why GitHub Copilot?

Here's my honest take after trying several model providers with OpenClaw:

GitHub Copilot is the best starting point for three reasons:

  1. Straightforward setup — a single CLI command handles authentication. No API key management, no token juggling.
  2. Multiple model options — with a Copilot Pro subscription ($10/month, often already included if you're a developer), you get access to models from multiple providers: Gemini, Claude, GPT, and more. It's like an all-in-one AI buffet.
  3. Generous limits — you get 300 premium requests per month. That's more than enough to learn OpenClaw and build real workflows.

Which Model to Pick?

Start with Gemini 3 Flash. Seriously.

I know it's tempting to jump straight to Claude Opus 4.6 or GPT-4o. But here's what I learned: Gemini 3 Flash is fast, handles most tasks well, and burns through your quota much slower because it's not a "premium" model in Copilot's billing.

You don't need Opus to start using OpenClaw. Save those premium requests for when you actually need deep reasoning. For everyday tasks — file management, quick scripts, message responses, code reviews — Gemini 3 Flash is more than enough.

3.1 Authenticate with GitHub Copilot

openclaw models auth login-github-copilot

This triggers GitHub's device flow authentication:

  1. You'll see a URL and a one-time code in your terminal
  2. Open the URL in any browser (your phone works fine)
  3. Enter the code and authorize access
  4. Keep the terminal open until the process completes — it takes about 10-15 seconds

3.2 Set Your Default Model

# Set Gemini 3 Flash as your default (recommended to start)
openclaw models set github-copilot/gemini-3-flash

# Or if you want to use Claude Sonnet
# openclaw models set github-copilot/claude-sonnet-4-5

# Or GPT-4o
# openclaw models set github-copilot/gpt-4o

3.3 Verify the Setup

openclaw doctor

This will check your configuration and confirm the model provider is working. Look for a green checkmark next to the model configuration.

Available Models via GitHub Copilot

Here are some models you can use through your Copilot subscription:

Model Command Best For
Gemini 3 Flash github-copilot/gemini-3-flash Fast daily tasks, code generation
GPT-4o github-copilot/gpt-4o General purpose, good reasoning
Claude Sonnet 4.5 github-copilot/claude-sonnet-4-5 Writing, analysis, code review
Claude Opus 4.6 github-copilot/claude-opus-4-6 Complex reasoning (uses premium quota)

You can switch models anytime:

openclaw models set github-copilot/<model-name>

What Happens When You Run Out of Premium Requests?

Here's something most guides won't tell you: you don't lose access when your 300 premium requests run out. GitHub Copilot includes several GPT models that cost zero premium requests — they're completely unlimited on paid plans:

Model Command Premium Cost
GPT-4.1 github-copilot/gpt-4.1 0 (unlimited)
GPT-4o github-copilot/gpt-4o 0 (unlimited)
GPT-5 mini github-copilot/gpt-5-mini 0 (unlimited)

So when your premium quota resets next month, use Gemini 3 Flash and Claude for your best work — and when the quota runs dry, just switch to GPT-4.1 or GPT-4o and keep going. Your agent never has to go offline.

# Switch to unlimited GPT-4.1 when premium runs out
openclaw models set github-copilot/gpt-4.1

Step 4: Connect Telegram (The Interface)

Telegram is the most popular messaging choice for OpenClaw users, and for good reason — it's free, encrypted, has a great bot API, and works seamlessly across phone, tablet, and desktop.

4.1 Create a Telegram Bot

  1. Open Telegram on your phone or desktop
  2. Search for @BotFather (the official bot for creating bots)
  3. Send the command: /newbot
  4. Choose a display name for your bot (e.g., "My AI Agent")
  5. Choose a username ending in bot (e.g., my_openclaw_agent_bot)
  6. BotFather will respond with your Bot Token — it looks like: 7123456789:AAHx...

Save this token securely. Never share it publicly or commit it to a repository.

Optional but recommended BotFather commands:

/setdescription     Set a description for your bot
/setabouttext       Set the "About" text
/setuserpic         Give your bot a profile picture
/setprivacy         Disable privacy mode if you want group support

4.2 Configure OpenClaw for Telegram

Edit the OpenClaw configuration file:

nano ~/.openclaw/openclaw.json

Add or update the Telegram channel configuration:

{
  channels: {
    telegram: {
      enabled: true,
      botToken: "YOUR_BOT_TOKEN_HERE",
      dmPolicy: "pairing",
      groups: {
        "*": {
          requireMention: true
        }
      }
    }
  }
}

Alternatively, you can set the token via environment variable:

export TELEGRAM_BOT_TOKEN="YOUR_BOT_TOKEN_HERE"

4.3 Start OpenClaw and Pair Your Telegram

Start the gateway:

openclaw gateway

Now pair your Telegram account:

  1. Open Telegram and send any message to your bot (e.g., "Hello")
  2. The bot will respond with a pairing code (a short alphanumeric string)
  3. In your EC2 terminal (open a second SSH session), approve the pairing:
# List pending pairing requests
openclaw pairing list telegram

# Approve the code you received
openclaw pairing approve telegram <CODE>

That's it. Your Telegram is now connected. Send a message to your bot and watch the AI respond.

4.4 Pro Tip: Use /new to Reset Sessions

This is something I learned the hard way. When you chat with your OpenClaw agent on Telegram, every message you send carries the entire conversation history as context to the AI model. If you discuss 5 different topics in one long session, your sixth request sends all of that previous context along with it.

This has two real consequences:

  1. Your token usage explodes — longer context means more tokens consumed per request. Your 300 premium requests on GitHub Copilot will drain much faster than expected.
  2. The model gets confused — with a bloated context full of unrelated topics, the AI's responses become less focused and less accurate.

The fix is simple: whenever you finish a topic or task, send the /new command to your bot. This resets the session and starts fresh. Think of it like closing a browser tab when you're done with a task.

/new

Make this a habit. Finished debugging that script? /new. Done asking about a recipe? /new. It keeps your sessions lean, your responses sharp, and your quota lasting much longer.

4.5 Understanding DM Access Policies

The dmPolicy setting controls who can message your bot:

Policy Behavior
pairing (default) Unknown senders get a pairing code; you must approve each one
allowlist Only specified Telegram user IDs can interact
open Anyone can message (not recommended)
disabled DMs are turned off

For a personal assistant, pairing is perfect — it ensures only you can talk to your agent.

4.6 Finding Your Telegram User ID

If you want to switch to allowlist mode later, you'll need your numeric Telegram ID:

  • Send a message to your bot and run openclaw logs --follow — look for the from.id field
  • Or message @userinfobot on Telegram — it replies with your user ID

Step 5: Keep It Running 24/7

If you installed with --install-daemon, OpenClaw is already configured as a systemd service. Here's how to manage it:

# Start the service
systemctl --user start openclaw-gateway

# Stop the service
systemctl --user stop openclaw-gateway

# Enable auto-start on boot
systemctl --user enable openclaw-gateway

# Check status
systemctl --user status openclaw-gateway

# View logs
journalctl --user -u openclaw-gateway -f

Enable Lingering (Important for EC2)

By default, systemd user services stop when you log out of SSH. To prevent this:

sudo loginctl enable-linger ubuntu

This ensures your OpenClaw agent keeps running even after you disconnect from SSH.


Step 6: Access the Control Dashboard Remotely

OpenClaw has a web-based control dashboard, but it binds only to localhost:18789 for security. To access it from your local machine:

# Run this on YOUR computer (not the EC2 instance)
ssh -N -L 18789:127.0.0.1:18789 -i your-key.pem ubuntu@<ec2-public-ip>

Then open http://localhost:18789/ in your browser.

Do NOT open port 18789 in your EC2 security group. The SSH tunnel approach is much more secure. The OpenClaw gateway should never be directly exposed to the public internet.


Step 7: Useful Configuration Tweaks

Customize the Agent Personality

Create a SOUL.md file in your OpenClaw workspace:

nano ~/.openclaw/workspace/SOUL.md
You are Vic, a helpful AI assistant. You're concise, practical, and have a good sense
of humor. When asked about code, you provide working examples. When managing files,
you always confirm before deleting anything.

Set Up Cron Automations

OpenClaw can perform tasks on a schedule. Edit your config:

{
  heartbeat: {
    enabled: true,
    intervalMinutes: 60,
    prompt: "Check if any of my GitHub repos have new issues and summarize them."
  }
}

Configure Stream Mode for Telegram

See the AI "typing" in real-time instead of waiting for the full response:

{
  channels: {
    telegram: {
      streamMode: "partial"
    }
  }
}

Options: "off" (wait for full response), "partial" (live typing preview), "block" (send in blocks).


Cost Breakdown

Component Monthly Cost Notes
AWS EC2 (t3.micro) $0.00 Free Tier for 12 months
OpenClaw $0.00 Open-source (MIT License)
Telegram Bot API $0.00 Free for developers
GitHub Copilot Pro $10.00 Often already part of your dev workflow
Total ~$10.00 A personal AI agent for the price of two coffees

After the 12-month Free Tier expires, a t3.micro instance runs about $7.50/month on-demand, or significantly less with Reserved Instances or Spot pricing.


Troubleshooting Common Issues

Bot not responding to Telegram messages

  1. Check if the gateway is running: systemctl --user status openclaw-gateway
  2. Verify pairing: openclaw pairing list telegram
  3. Check logs: openclaw logs --follow
  4. Make sure outbound HTTPS to api.telegram.org is not blocked

GitHub Copilot authentication fails

  1. Re-run openclaw models auth login-github-copilot
  2. Make sure you have an active GitHub Copilot subscription
  3. Try a different model ID if one is rejected

EC2 instance running out of memory

The t3.micro has only 1 GB RAM. If OpenClaw struggles:

# Check memory usage
free -h

# Create a swap file (2 GB)
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

# Make it permanent
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

General health check

openclaw doctor    # Diagnose configuration issues
openclaw status    # Check gateway and channel status

Security Considerations

Self-hosting an AI agent is powerful but comes with responsibility:

  • Never expose port 18789 publicly — always use SSH tunnels for dashboard access
  • Run OpenClaw as a non-root user — the ubuntu user on EC2 is fine
  • Be cautious with third-party Skills — Cisco's AI security team found cases of data exfiltration in unvetted community skills. Only install skills from trusted sources
  • Review before executing — OpenClaw can run arbitrary shell commands. If you're giving it access to sensitive systems, set appropriate boundaries in your agent's personality prompt
  • Keep it updated — run openclaw update --channel stable regularly

Real Examples: What Can You Actually Do With It?

Once your setup is running, here are concrete things you can message your agent on Telegram right away:

File and server management:

"Check how much disk space is left on this server"
"Show me the last 20 lines of /var/log/syslog"
"Create a backup of my ~/projects folder and compress it"

Quick coding tasks:

"Write a Python script that monitors a URL and alerts me if it goes down"
"Generate a .gitignore file for a Node.js project and save it to ~/projects/myapp/"

Research and summarization:

"Summarize the changelog for the latest OpenClaw release"
"What are the key differences between t3.micro and t3.small on AWS?"

Scheduled automations (using heartbeat):

"Every hour, check if my website https://example.com returns a 200 status code"
"Every morning at 9am, summarize any new GitHub issues in my repos"

These aren't hypothetical — they work out of the box with the setup described in this guide. Start simple and build up from there.


What's Next?

Once your basic setup is running, explore these capabilities:

  • Add more channels — connect Slack, Discord, or WhatsApp alongside Telegram
  • Build custom Skills — automate repetitive tasks specific to your workflow
  • Browser automation — let your agent navigate websites and fill out forms
  • Device nodes — connect your phone as a camera/sensor node for your agent
  • Multi-agent setups — run specialized agents that communicate with each other

The OpenClaw ecosystem is evolving rapidly. Check the official documentation and the GitHub repository for the latest features and community skills.


Wrapping Up

Setting up OpenClaw on EC2 with Telegram and GitHub Copilot gives you a remarkably capable personal AI agent for just $10/month. The key takeaways from my experience:

  1. Start cheap — EC2 Free Tier is the perfect playground. Don't invest in hardware until you know OpenClaw fits your workflow.
  2. Start with a fast model — Gemini 3 Flash through GitHub Copilot handles 90% of tasks without eating your premium request quota.
  3. Telegram is the sweet spot — it's the easiest messaging platform to set up and gives you instant access to your agent from anywhere.
  4. The swap file trick saves you — on a t3.micro, adding a 2 GB swap file prevents out-of-memory crashes during heavy tasks.

This is what personal computing looks like in 2026 — an AI agent that's always on, always reachable, and entirely under your control.





Thanks for feedback.



Read More....
AI Coding Agents Compared: Cursor vs Copilot vs Claude Code vs Windsurf in 2026
AI-Native Documentation
Agentic Workflows vs Linear Chat
Automating UI Testing Vision Agents
Building Tool-Use AI Agents
Pinecone RAG Second Brain