Deploy openclaw.ai on AWS EC2
Deploy on Amazon's industry-leading cloud with EC2. Free tier eligible for new accounts!
AWS Free Tier
New AWS accounts get 750 hours/month of t2.micro or t3.micro instances free for 12 months â enough to run openclaw.ai 24/7 at no cost.
đ Prerequisites
Launch an EC2 Instance
Open the EC2 Console and launch a new instance:
- Click Launch Instance
- Name your instance (e.g.,
openclaw-server) - Under Application and OS Images, select Ubuntu Server 22.04 LTS (64-bit x86)
- Under Instance type, choose t3.micro (free tier eligible, 1 GB RAM) or t3.small (2 GB RAM) for better performance
- Under Key pair, select an existing key or click Create new key pair â download and save the
.pemfile securely - Under Network settings, allow SSH traffic from My IP
- Set Storage to at least 20 GiB gp3
- Click Launch Instance
Key Pair Security
Store your .pem file in a safe location and set its permissions with chmod 400 your-key.pem. You'll need this file every time you SSH into the instance.
Connect via SSH
Once the instance state shows Running, connect using your key pair:
# Set key permissions (first time only)
chmod 400 your-key.pem
# Connect to your EC2 instance
# Ubuntu AMIs use 'ubuntu' as the default user
ssh -i your-key.pem ubuntu@your-ec2-public-ip
You can find the public IP in the EC2 Console under Instance Details â Public IPv4 address.
System Update & Dependencies
Update the package index and upgrade all installed packages:
sudo apt update && sudo apt upgrade -y
Install Node.js 22
openclaw.ai requires Node.js 22 or higher. Install it from the official NodeSource repository:
curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version # Should show v22.x.x
Install openclaw.ai
Run the official one-line installer:
curl -fsSL https://openclaw.ai/install.sh | bash
Run Onboarding
Launch the interactive onboarding wizard. The --install-daemon flag automatically configures openclaw.ai to run as a background service:
openclaw onboard --install-daemon
The wizard will walk you through:
- Authentication setup (API keys for your LLM provider)
- Gateway configuration (port, allowed origins)
- Optional channel setup (Slack, Discord, etc.)
Verify Installation
Confirm everything is running correctly:
# Check system configuration
openclaw doctor
# Verify the gateway is healthy
openclaw health
# Open the web dashboard
openclaw dashboard
# Dashboard available at http://your-ec2-public-ip:18789
Configure Security Group
AWS Security Groups act as virtual firewalls. Add an inbound rule to allow access to the openclaw.ai dashboard:
- In the EC2 Console, select your instance
- Click the Security tab â click the Security Group link
- Click Edit inbound rules â Add rule
- Configure the new rule:
Type Protocol Port Range Source
Custom TCP TCP 18789 My IP
- Click Save rules
Security Warning
Always set Source to My IP instead of Anywhere (0.0.0.0/0). This restricts dashboard access to your current IP address only.
Keep Running with systemd
The --install-daemon flag from Step 6 already set up a systemd user service. To check its status:
# Check gateway status via openclaw CLI
openclaw gateway status
# Or check directly via systemd
systemctl --user status openclaw-gateway
# View live logs
journalctl --user -u openclaw-gateway -f
The service will automatically restart on failure and start on boot.
Elastic IP
EC2 public IPs change on instance restart. Allocate an Elastic IP in the EC2 Console and associate it with your instance for a permanent address.
đ§ Troubleshooting
Ensure you're using the correct key file and username. Ubuntu AMIs use ubuntu, not root:
# Correct command for Ubuntu AMI
ssh -i your-key.pem ubuntu@your-ec2-ip
# Ensure key permissions are correct
chmod 400 your-key.pem
Check all three layers: the gateway process, the OS firewall, and the AWS Security Group:
# Is the gateway listening?
ss -tlnp | grep 18789
# Check OS-level firewall
sudo ufw status
# Verify Security Group from the CLI
aws ec2 describe-security-groups \
--group-ids sg-your-group-id \
--query "SecurityGroups[*].IpPermissions"
EC2 instances lose their public IP when stopped and restarted. To get a static IP:
- Go to EC2 Console â Elastic IPs â Allocate Elastic IP address
- Select the new IP â Actions â Associate Elastic IP address
- Choose your instance and confirm
Elastic IPs are free while associated with a running instance.
Was this helpful?