EC1: A CloudStack Alternative in Go
April 20, 2025 · View on GitHub
EC1 is a lightweight, Go-based alternative to Apache CloudStack – providing VM and network orchestration without the legacy bloat. It uses modern Go libraries, ConnectRPC (a gRPC + Protocol Buffers framework), and simple Go services for a lean cloud management experience.
Overview
This project is a proof-of-concept (POC) demonstrating that we can manage virtual machines (including nested VMs and networking) with minimal complexity using modern Go libraries.
Architecture:
- Management Server: Central orchestration component that manages VM lifecycle across hosts
- Agent: Runs on each host to execute VM operations using the local hypervisor
- Hypervisors: Support for Apple Virtualization.framework (macOS) and KVM (Linux)
Features
- Multi-host VM orchestration with nested virtualization
- Support for different hypervisors (macOS virtualization and KVM)
- Networking with port forwarding
- Simple API based on ConnectRPC (gRPC)
- Complete infrastructure as code, written in Go
Demo
The demo showcases a full end-to-end nested virtualization flow:
- Start a Management Server on macOS
- Start a local Agent on macOS
- Create a QCOW2 image for a Linux VM
- Start a Linux VM on macOS using Apple's Virtualization.framework
- Set up an EC1 Agent inside the Linux VM
- Use the Linux Agent to start a nested VM
- Run a web server in the nested VM
- Access the web server from the host
Running the Demo
Prerequisites:
- macOS (with support for Virtualization.framework)
- Go 1.21 or later
- QEMU and related tools (
brew install qemu)
To run the full demo:
# Run the complete demo
./go run ./cmd/demo --action demo
# To clean up previous runs
./go run ./cmd/demo --action demo --clean
# To run individual steps
./go run ./cmd/demo --action start-mgt
./go run ./cmd/demo --action start-agent
./go run ./cmd/demo --action create-image
./go run ./cmd/demo --action start-linux-vm --disk images/alpine.qcow2
./go run ./cmd/demo --action start-nested-vm
Project Structure
cmd/: Command line toolsdemo/: Demo steps and entry pointmgt/: Management serveragent/: Agent implementation
pkg/: Core packageshypervisor/: Hypervisor implementations (Apple, KVM)management/: Management server implementationagent/: Agent service implementation
proto/: Protocol Buffer definitionsgen/: Generated code from Protocol Buffers
Development
This project is developed as a proof-of-concept to demonstrate cloud management capabilities with Go. It is not intended for production use at this stage but provides a foundation for a more complete implementation.
License
See LICENSE file.