Deployment Model
EC2 provisioning: user-data script, instance lifecycle, and configuration.
When you first visit the Chat page on SkyKoi, an automated provisioning sequence creates your dedicated EC2 instance. Everything is handled by a user-data script that runs on instance boot.
Provisioning Sequence
- •1. EC2 launch — SkyKoi API launches a t3.small instance (Ubuntu 22.04) in us-east-1 with the
skykoi-tenant-agent-profileIAM instance profile - •2. User-data script runs — On boot, the instance executes a provisioning script that installs all dependencies
- •3. Node.js 22 — Installed for the agent runtime
- •4. AWS CLI v2 — Installed for agent AWS operations
- •5. nginx — Installed and configured with self-signed TLS, reverse proxying port 443 → localhost:18789
- •6. Agent runtime — Installed globally via npm
- •7. Docker — Installed (available for agent use)
- •8. jq — Installed for JSON processing
- •9. Config generation —
config-generator.tscreates the agent config with Gateway mode, auth, and Bedrock model config - •10. Workspace seeding — AGENTS.md, SOUL.md, USER.md, TOOLS.md, and IDENTITY.md are written to
/home/ubuntu/koi/ - •11. Gateway startup — The Gateway daemon starts as a systemd service
- •12. Ready signal — Instance reports ready to the SkyKoi API
💡The entire provisioning process takes approximately 2–3 minutes from EC2 launch to a ready Gateway.
Instance Configuration
- •Instance type — t3.small (2 vCPU, 2 GB RAM)
- •OS — Ubuntu 22.04 LTS
- •Region — us-east-1
- •IAM profile —
skykoi-tenant-agent-profile(Bedrock access) - •Security group — Ports 22, 80, 443, 8080, 18789
- •Gateway port — 18789 (localhost), proxied through nginx on 443
- •Gateway mode —
local - •Auth mode —
token
Systemd Service
The Koi Gateway runs as a systemd service for reliability:
text
Service: skykoi-gateway.service
Command: Gateway daemon
Restart: on-failure
User: ubuntu
WorkingDirectory: /home/ubuntu/koiStandard systemd commands apply:
bash
# Check status
sudo systemctl status skykoi-gateway
# Restart the Gateway
sudo systemctl restart skykoi-gateway
# View logs
sudo journalctl -u skykoi-gateway -fHealth Checks
SkyKoi monitors each instance through:
- •EC2 status checks — Instance-level health (system + instance reachability)
- •Gateway health — WebSocket
healthmethod returns provider status, uptime, and connection health - •Heartbeat monitoring — Optional periodic agent health checks via the built-in heartbeat system
