How samuelmarti22/controllerasg works
ControllerASG is a self-managed EC2 autoscaling controller. Its main workflow loads validated configuration, periodically reads managed fleet state, observes CloudWatch metrics, applies safety and threshold rules, performs EC2/Target Group changes, and records one auditable decision per tick. The README documents additional operational capabilities; the sampled source confirms the core runtime wiring and scaling actions, but not every behavior such as signal handling details beyond main or the validation-only mode.
Main entry points: controller.go Cycle and policy · provisioner.go Fleet and actuator · main.go Runtime entry · observer.go Metric observer
Components 15
Control loop
- Runtime entry
main/main.go - Cycle and policy
controller/controller.go
AWS integration
- Metric observer
observer/observer.go - Fleet and actuator
provisioner/provisioner.go
Decision audit
- JSONL logger
logger/logger.go
Domain and config
- Config loader
configuration/configuration.go - Decision record
model/decision.go - Fleet instance
model/instances.go - Observed metric
model/metrics.go
Other components
- Operator
- CloudWatch
- EC2
- ELB Target Group
- Configuration file
- Decision log
Connections 20
- Operator → Runtime entry: starts
- Runtime entry → Config loader: loads and validates
- Configuration file → Config loader: provides settings
- Runtime entry → Cycle and policy: ticks periodically
- Runtime entry → Metric observer: constructs
- Runtime entry → Fleet and actuator: constructs
- Runtime entry → JSONL logger: constructs
- Cycle and policy → Fleet and actuator: reads fleet
- Fleet and actuator → EC2: describes instances
- Fleet and actuator → ELB Target Group: reads target health
- Cycle and policy → Metric observer: requests metrics
- Metric observer → CloudWatch: queries metrics
- Metric observer → Observed metric: returns aggregates
- Cycle and policy → Fleet instance: supplies fleet
- Cycle and policy → Fleet and actuator: scales fleet
- Fleet and actuator → EC2: launches or terminates
- Fleet and actuator → ELB Target Group: registers or drains
- Cycle and policy → Decision record: builds cycle record
- Cycle and policy → JSONL logger: logs each tick
- JSONL logger → Decision log: writes JSONL