← Back to list

Enhancing EC2 with Localhost

I host the OpenClaw bot on EC2. Since the workload is light, I do not keep EC2 running all the time, but instead trigger it to start when I…

Evgeny Arbatov · 2026-03-23 09:08 · 0 claps · 1.6 min read
#openclaw #ec2 #aws #cloudflare #colima
Open on Medium ↗
Wiki topics: ☁️ · DevOps & Cloud ⚖️ · Law & Justice 🏃 · Running & Endurance

Enhancing EC2 with Localhost

I host the OpenClaw bot on EC2. Since the workload is light, I do not keep EC2 running all the time, but instead trigger it to start when I receive messages on a Telegram webhook.

For a while, I thought there was no way to improve this setup, since I cannot predict when traffic will hit the bot. Then I learned about Cloudflare Connectors using cloudflared.

What if I ran the same Docker containers locally as I do on EC2 and proxied the requests locally?

This turned out to be a plausible way to offload some processing from EC2 and save on compute since my bot is mostly used when localhost is up. As a bonus, I got a more responsive bot because I no longer need to wait for EC2 to start — assuming macOS has not entered power save mode.

The setup works as follows: Telegram triggers a webhook via a Lambda function URL. The Lambda always first tries to reach the public Cloudflare Connector URL. If that fails, it puts the message into SQS and starts EC2.

On macOS, I use Colima with containerd. I had to migrate away from Docker Desktop because it became unresponsive after a while. Colima appears to be more stable.

The local Docker setup mirrors EC2, with the addition of a simple FastAPI proxy that exposes a /health endpoint to verify that both Ollama and OpenClaw have started inside Colima containers.

Surprisingly, this is all that is required to make it work. Most of the time actually went into migrating from Docker Desktop to Colima.

I think this is a handy design that is useful beyond running chatbots. If you have a lightweight task that would normally require spinning up EC2, and you have a localhost that happens to be online most of the time, you can serve some requests locally — saving on EC2 compute and even improving the overall UX by cutting the 30-second EC2 startup delay.

One use case I have in mind is running OSRM for an OSM extract — exactly the kind of task that is too large for Lambda but would leave EC2 sitting mostly idle.

And the best part? The Cloudflare Connector is free to use and has no known rate limits.


메타데이터
post_id
46c4bcba5483
slug
enhancing-ec2-with-localhost-46c4bcba5483
url
https://medium.com/@arbatov/enhancing-ec2-with-localhost-46c4bcba5483
canonical_url
https://medium.com/@arbatov/enhancing-ec2-with-localhost-46c4bcba5483
author_url
https://medium.com/@arbatov
status
ok
fetched_at
2026-06-12 18:14:10