Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

225 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Deploy Your Personal OpenClaw on AWS AgentCore β€” Serverless, ~$9/month

License: MIT AWS CloudFormation Python 3.10+ Built with Kiro

Cost-optimized OpenClaw deployment using AWS Bedrock AgentCore Runtime. Connect via Discord, WhatsApp, Telegram, or Slack. ~$9-15/month infrastructure.

Launch Stack

What Is This?

A single-user, serverless deployment of OpenClaw on AWS. Instead of running an EC2 instance 24/7, the AI runs on-demand via AgentCore Runtime β€” the container freezes between invocations, so you only pay when you use it.

All messaging plugins (WhatsApp, Telegram, Discord, Slack) are pre-installed in OpenClaw. This template includes a Discord bot by default, but you can connect any platform directly through the OpenClaw Web UI.

Architecture

You (Discord / WhatsApp / Telegram / Slack)
  β”‚
  β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  AWS Cloud                                               β”‚
β”‚                                                          β”‚
β”‚  EC2 t4g.nano ──invoke──▢  AgentCore Runtime             β”‚
β”‚  (Discord bot)             (OpenClaw container)          β”‚
β”‚                                β”‚                         β”‚
β”‚                            IAM Role                      β”‚
β”‚                                β”‚                         β”‚
β”‚                            Bedrock                       β”‚
β”‚                          (Haiku/Sonnet/Nova)             β”‚
β”‚                                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚
β”‚  β”‚ KMS     β”‚  β”‚ Secrets  β”‚  β”‚ S3      β”‚  β”‚EventBridgeβ”‚ β”‚
β”‚  β”‚(encrypt)β”‚  β”‚ Manager  β”‚  β”‚(sessionsβ”‚  β”‚(cron jobs) β”‚ β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚ memory) β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚
β”‚                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                 β”‚
β”‚  CloudWatch ─── SNS ─── Budget Alerts                    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  β”‚
  β–Ό
You (receive response)
  • AgentCore Runtime: Runs OpenClaw in a managed container that freezes when idle
  • EC2 nano: Lightweight Discord bot relay (~512MB RAM, only needed for Discord)
  • Bedrock: Model inference via IAM β€” no API keys to manage
  • EventBridge β†’ Lambda: External cron scheduler (container freezes make in-container cron unreliable)

Cost Comparison

Original EC2 Deployment Lightsail Deployment This AgentCore Deployment
Compute EC2 running 24/7 (~$35/mo) Lightsail 4GB plan ($24/mo) Serverless, pay-per-use
Complexity Multi-tenant, VPC required Pre-configured, simple Single-user, minimal infra
Scaling Manual Fixed instance Auto-freezes when idle
Typical cost ~$80/month ~$24/month* ~$9-15/month**

*Lightsail cost excludes model tokens (Bedrock usage billed separately). **~$4 EC2 nano (Discord bot) + ~$3.60 public IPv4 + ~$1 KMS + pennies for ECR/S3/Secrets Manager/CloudWatch. Model token costs are additional and vary by usage.

Note: If you use WhatsApp or Telegram (webhook-based) instead of Discord, you can eliminate the EC2 instance entirely β€” reducing infra to ~$1-2/month.

Models

Switch models with one parameter in .env β€” no code changes:

Model Input / Output per 1M tokens Best for
Claude Haiku 4.5 (default) $1.00 / $5.00 Fast, efficient, great for daily tasks
Claude Sonnet 4 $3.00 / $15.00 Complex reasoning, coding
Nova Lite $0.06 / $0.24 Budget-friendly, simple tasks
Nova Pro $0.80 / $3.20 Balanced performance, multimodal
DeepSeek R1 $0.55 / $2.19 Open-source reasoning

Uses cross-region inference profiles (us. prefix) β€” requests auto-route to optimal locations for higher throughput.

What Can OpenClaw Do?

Once connected, just message it:

You: What's the weather in Austin?
You: Summarize this PDF [attach file]
You: Remind me every Sunday at 9am to check the weather forecast
You: Search the web for AWS Bedrock pricing
You: Add eggs and milk to my shopping list
You: What are my Google Calendar events today?

OpenClaw comes with 30+ bundled skills. This template adds custom skills for weather, notes/reminders, stock tracking, soccer scores, and more via the community-skills.json system.

Security

Layer What it does
KMS (CMK) Encrypts S3 data, Secrets Manager values, and SNS topics
Secrets Manager Stores all sensitive values (API keys, tokens) β€” no plaintext in CloudFormation
IAM Roles Least-privilege per component (AgentCore, Discord bot, Lambda, Scheduler)
S3 Bucket Policy Restricts session/memory access to the execution role only
No public ports Discord bot calls out only β€” nothing listens for inbound connections
AgentCore isolation Container runs in AWS-managed environment, not a raw EC2
Budget alerts SNS notifications at 80% and 100% of configurable monthly limit
CloudWatch Monitoring and alarming on spend

Prerequisites

  • AWS CLI configured with your account (aws configure)
  • Docker running locally (used to build the AgentCore container image)
  • Go 1.21+ (for cross-compiling the Alexa CLI and GOG CLI binaries)
  • Bedrock model access enabled for your chosen model
  • A Discord bot token (optional β€” only if using the Discord integration)

Quick Start

1. Configure

cp agent-container/.env.example agent-container/.env
# Edit .env with your settings (model ID, Discord token, etc.)

2. Deploy

bash scripts/deploy.sh

This single command handles everything: validates the template, builds the Docker image, pushes to ECR, deploys/updates the CloudFormation stack, and deploys the Discord bot.

3. Chat

In Discord: @YourBot hello!

Or open the OpenClaw Web UI via SSM port forwarding to connect WhatsApp, Telegram, or Slack.

🎯 Deploy with Kiro AI

Prefer a guided experience? Kiro walks you through deployment conversationally β€” just open this repo as a workspace and say "help me deploy my personal OpenClaw".

β†’ Kiro Deployment Guide

After Deployment

# Check stack status
aws cloudformation describe-stacks --stack-name openclaw-personal --region us-east-2

# Test the runtime directly
aws bedrock-agentcore invoke-agent-runtime \
  --agent-runtime-arn "YOUR_RUNTIME_ARN" \
  --payload "$(echo -n '{"message":"hello"}' | base64)" \
  /tmp/output.json --region us-east-2

# View Discord bot logs (via SSM)
aws ssm send-command --instance-ids YOUR_INSTANCE_ID \
  --document-name "AWS-RunShellScript" \
  --parameters 'commands=["journalctl -u discord-bot -n 30"]' \
  --region us-east-2

Project Structure

β”œβ”€β”€ openclaw-simplified.yaml    # CloudFormation template (entire stack)
β”œβ”€β”€ agent-container/            # Docker container for AgentCore
β”‚   β”œβ”€β”€ server.py               # HTTP server wrapping OpenClaw
β”‚   β”œβ”€β”€ openclaw.json           # OpenClaw configuration
β”‚   β”œβ”€β”€ skills/                 # Custom skills (weather, notes, stocks, etc.)
β”‚   β”œβ”€β”€ community-skills.json   # ClawHub skills to auto-install at build time
β”‚   β”œβ”€β”€ Dockerfile
β”‚   └── requirements.txt
β”œβ”€β”€ discord-bot/                # Python Discord bot (runs on EC2)
β”‚   β”œβ”€β”€ bot.py                  # Bot using boto3 invoke-agent-runtime
β”‚   └── requirements.txt
β”œβ”€β”€ scripts/                    # Deployment & utility scripts
β”‚   β”œβ”€β”€ deploy.sh               # Full deployment (build + push + CFN)
β”‚   β”œβ”€β”€ quick-redeploy.sh       # Rebuild & push container only
β”‚   β”œβ”€β”€ deploy-discord-bot.sh   # Update bot on EC2 via SSM
β”‚   β”œβ”€β”€ install-community-skills.sh  # Auto-install ClawHub skills
β”‚   └── ...
└── docs/                       # Documentation

Key Features

  • Serverless AI: AgentCore Runtime β€” container freezes when idle, no idle costs
  • Session persistence: Conversations, memory, and workspace backed up to S3
  • Memory consolidation: agent-memory-daemon runs alongside OpenClaw β€” extracts facts, preferences, and decisions from sessions, deduplicates and prunes memory files, keeps MEMORY.md organized and size-budgeted
  • EventBridge cron: Scheduled tasks via EventBridge β†’ Lambda β†’ AgentCore (survives container freezes)
  • Multi-platform: Discord bot included, WhatsApp/Telegram/Slack via OpenClaw plugins
  • Custom skills: Weather, notes/reminders, stock watcher, soccer scores, personal assistant
  • Community skills: Auto-install from ClawHub via community-skills.json at build time
  • Budget protection: Tag-based budget tracking with SNS alerts
  • Model flexibility: Switch models by changing one line in .env

Documentation

FAQ

How much does it cost to run OpenClaw on AWS? Infrastructure costs ~$9-15/month: a t4g.nano EC2 for the Discord bot (~$4), public IPv4 (~$3.60), KMS (~$1), and pennies for ECR/S3/Secrets Manager. Model token costs are additional and depend on usage β€” typically $5-15/month for personal use with Haiku 4.5.

What's the cheapest way to host OpenClaw? This AgentCore setup is one of the cheapest at ~$9/mo infra. If you use Telegram or WhatsApp instead of Discord (webhook-based, no EC2 needed), infra drops to ~$1-2/mo. Lightsail is $24/mo flat. A full EC2 deployment runs $35-80/mo.

Can I run OpenClaw without EC2? Yes β€” the EC2 instance is only needed for the Discord bot (Discord requires a persistent WebSocket connection). If you use WhatsApp or Telegram (webhook-based), you can eliminate EC2 entirely and run fully serverless via API Gateway + Lambda + AgentCore.

How is this different from the Lightsail deployment? Lightsail runs OpenClaw on an always-on VM ($24/mo). This stack uses AgentCore Runtime where the container freezes when idle β€” you only pay for compute during active use. For a personal assistant used a few times a day, that's significantly cheaper.

Does this work with models other than Claude? Yes β€” switch models by changing one line in .env. Supports Claude Haiku 4.5, Claude Sonnet 4, Amazon Nova Lite, Nova Pro, DeepSeek R1, and any model available through Bedrock cross-region inference profiles.

Is my data secure? All secrets are stored in AWS Secrets Manager with KMS encryption. S3 bucket access is restricted to the execution role. IAM roles follow least-privilege per component. No ports are exposed to the internet. See the Security section for details.

How long does deployment take? About 10 minutes. bash scripts/deploy.sh handles everything: template validation, Docker build, ECR push, CloudFormation deploy, and Discord bot setup.

Resources

License

See LICENSE for details.

About

Deploy your own personal OpenClaw on AWS Bedrock AgentCore β€” serverless, ~$9/mo, one-click CloudFormation, Discord/WhatsApp/Telegram 🦞

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages