Step-by-step guide to installing and configuring OpenClaw on an Ubuntu EC2 instance on AWS — from launching the instance to running your first agent.
In this guide
In the AWS Console, launch an Ubuntu 22.04 LTS t3.medium or larger instance (OpenClaw needs at least 2 vCPU and 4GB RAM for stable operation). Create or use an existing key pair (.pem file). In your Security Group, allow inbound SSH (port 22) from your IP. Connect: ssh -i "your-key.pem" ubuntu@your-ec2-ip.
Run: sudo apt update && sudo apt upgrade -y. Then install required packages: sudo apt install -y curl git python3 python3-pip nodejs npm build-essential. Verify Node.js version is 18+: node --version. If it is older, install the latest LTS via nvm: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash — then: nvm install --lts.
Follow the official OpenClaw installation command from the OpenClaw documentation. After installation, run openclaw init to initialize your workspace directory. OpenClaw creates its workspace at ~/.openclaw/ by default. You can change this by setting the OPENCLAW_HOME environment variable in your ~/.bashrc before installation.
Set your API keys in the OpenClaw config: openclaw config set ANTHROPIC_API_KEY your_key_here. For production use, add your keys to /etc/environment or your ~/.bashrc so they persist across sessions and reboots. Avoid storing keys in project files that may be committed to version control.
Install PM2: npm install -g pm2. Start OpenClaw: pm2 start "openclaw serve" --name openclaw. Save the process list: pm2 save. Enable auto-start on reboot: pm2 startup — follow the command it outputs (usually sudo env PATH=...). PM2 ensures OpenClaw restarts automatically if it crashes or the server reboots.
If you want to access OpenClaw via a domain, install Nginx: sudo apt install -y nginx. Create a site config at /etc/nginx/sites-available/openclaw with a proxy_pass to localhost:openclaw_port. Enable it: sudo ln -s /etc/nginx/sites-available/openclaw /etc/nginx/sites-enabled/ && sudo nginx -t && sudo systemctl reload nginx. Then add SSL with Certbot.
Need Help?
Our engineering team handles implementations like this every week. Get a free scoping call — we will tell you exactly what it takes and what it costs.
Book a free callCompetitive Intelligence
Efficiency Modeling
© 2026 NexWorldTech — Built for Global Dominance.