Back to browse
GitHub Repository

Terraform module for OpenClaw AI agent gateway on AWS with ALB, Cognito authentication, EFS persistence, and multi-provider LLM support (Bedrock, Anthropic, OpenAI, Ollama).

20 starsHCL

Hardened OpenClaw on AWS with Terraform

by aleks2·Mar 13, 2026·10 points·3 comments

AI Analysis

●●SolidSolve My Problem

Replaces curl-pipe-sh defaults with Cognito MFA and proper AWS security patterns.

Strengths
  • Addresses 31 CVEs and 30k exposed instances from insecure defaults.
  • Systemd hardening and KMS-encrypted secrets show production thinking.
Weaknesses
  • Only targets AWS—no GCP or Azure equivalents offered.
  • Terraform module niche limits audience to infra teams specifically.
Target Audience

DevOps engineers deploying AI gateways

Similar To

terraform-aws-modules · Pulumi AI templates

Post Description

I work on AWS infrastructure (ex-Percona, Box, Dropbox, Pinterest). When OpenClaw blew up, I wanted to run it properly on AWS and was surprised by the default deployment story. The Lightsail blueprint shipped with 31 unpatched CVEs. The standard install guide uses three separate curl-pipe-sh patterns as root. Bitsight found 30,000+ exposed instances in two weeks. OpenClaw's own maintainer said "if you can't understand how to run a command line, this is far too dangerous."

So I built a Terraform module that replaces the defaults with what I'd consider production-grade:

* Cognito + ALB instead of a shared gateway token (per-user identity, MFA) * GPG-verified APT packages instead of curl|bash * systemd with ProtectHome=tmpfs and BindPaths sandboxing * Secrets Manager + KMS instead of plaintext API keys * EFS for persistence across instance replacement * CloudWatch logging with 365-day retention Bedrock is the default LLM provider so it works without any API keys. One terraform apply. Full security writeup: https://infrahouse.com/blog/2026-03-09-deploying-openclaw-on...

I'm sure I've missed things. What would you add or do differently for running an autonomous agent with shell access on a shared server?

Similar Projects

Security●●Solid

NixOS flake for hardened OpenClaw deployment

Two lines in your flake flip OpenClaw from alarmingly exposed to locked-down: gateway auth, localhost binding, Caddy auto-TLS, strict systemd directives, tool allowlists, and fail2ban are all wired in. It's a pragmatic, opinionated safety wrapper that saves you from the default footguns — just expect it to be useful only if you already live in the NixOS/OpenClaw world.

Niche GemSolve My Problem
scout_agent
103mo ago