AWS Builder Center
Building a Lightweight EC2 Orchestrator with Go and Native AWS Services

Building a Lightweight EC2 Orchestrator with Go and Native AWS Services

What if a small application needs self-healing, autoscaling, health checks, and rolling deployments but not a full Kubernetes platform? This article explores how Go, EC2 Auto Scaling, ALB, CloudWatch, Systems Manager, and simple Bash scripts can create a lightweight deployment experience on AWS.

aimlops | devops engineer | aws community builder | open source contributor |
Kubernetes gives us powerful features such as scaling, self-healing, rolling deployments, and service management. But for a small application running only a few backend services, using a full Kubernetes platform can sometimes be more than we actually need.
That made me think about a simpler question:
How much of that deployment experience can we build using native AWS services, Go, and a little Bash?
The goal is not to replace Amazon EKS. Instead, the idea is to create a lightweight orchestration layer for applications that already run comfortably on Amazon EC2.

The Problem

Imagine we have several backend APIs running on EC2.
Initially, deployment might be simple: launch an instance, install the application, and start the service.
But eventually we need more.
We want multiple instances for availability. If one becomes unhealthy, it should be replaced automatically. When traffic increases, more instances should start. New application versions should be deployed gradually instead of replacing every server at once.
We also want a failed release to be easy to roll back.
These are orchestration problems, but AWS already provides many of the building blocks needed to solve them.

Using AWS as the Building Blocks

Instead of creating everything ourselves, we can combine several AWS services.
Amazon EC2 Auto Scaling can maintain the required number of instances and replace unhealthy ones.
Application Load Balancer can distribute traffic and continuously check whether application instances are healthy.
EC2 Launch Templates can define how new application servers should be created.
Amazon CloudWatch can provide metrics and trigger scaling decisions.
AWS Systems Manager can help manage instances without depending on public SSH access.
Finally, a small tool written in Go using the AWS SDK for Go can connect these services and provide a simpler developer experience.
Bash can handle only the small amount of initialization required when a new instance starts.

Defining What We Want

Instead of manually changing several AWS resources for every deployment, the application could be described with a small configuration file.
service: users-api
version: v1.8.0

instance:
type: t4g.small

scaling:
min: 2
desired: 2
max: 8

health:
path: /health

Then deployment could be as simple as:
gocontrol apply service.yaml

The Go tool reads the configuration and uses AWS APIs to make the infrastructure match that desired state.
If two instances should always exist, Auto Scaling maintains two.
If demand increases, the group can scale.
If an instance becomes unhealthy, AWS can replace it.
The developer describes the result they want instead of manually operating individual servers.

Making Deployments Safer

One important rule would be to make every application release versioned.
Instead of downloading:
users-api/latest

we could store releases such as:
users-api/v1.7.0
users-api/v1.8.0
users-api/v1.9.0

When  v1.9.0  is deployed, the Go tool creates a new Launch Template version and starts an EC2 Auto Scaling Instance Refresh.
AWS can then gradually replace older instances with new ones.
The new server starts the application and must successfully respond to something like:
GET /health

before the load balancer considers it healthy.
This means traffic does not immediately reach an application just because the EC2 instance has started.

Self-Healing Without Building Everything Ourselves

Suppose one application instance crashes.
The Application Load Balancer begins failing its health checks and stops sending traffic to that target.
EC2 Auto Scaling can then replace the unhealthy instance with a fresh one.
The new instance starts, runs its bootstrap process, downloads the correct application version, launches the service, and eventually becomes healthy.
That gives us a basic self-healing system without writing our own server-monitoring engine.

Automatic Scaling

Scaling can also stay simple.
For example:
scaling:
min: 2
max: 8
cpuTarget: 60

The Go tool can configure an Auto Scaling target tracking policy.
When demand increases, additional EC2 instances can be launched. When demand falls, unnecessary capacity can be removed.
Again, the Go tool is not doing the scaling itself.
It is configuring AWS services to do it.

Where Go and Bash Fit

I would keep the responsibilities clearly separated.
Go handles the control layer.
It can create or update Launch Templates, Auto Scaling groups, scaling policies, target groups, deployments, and rollback operations using the AWS SDK.
A future CLI could provide commands such as:
gocontrol apply
gocontrol deploy
gocontrol status
gocontrol scale
gocontrol rollback

Bash handles only instance initialization.
For example, a startup script might download a versioned application artifact and start a systemd service.
aws s3 cp \
s3://my-artifacts/users-api/v1.8.0/users-api \
/usr/local/bin/users-api

chmod +x /usr/local/bin/users-api

systemctl enable users-api
systemctl start users-api

This keeps Bash simple while the Go application handles higher-level deployment logic.

What About Amazon EKS?

This approach is not intended to compete with Amazon EKS.
EKS provides the complete Kubernetes ecosystem and is a much better choice when applications require sophisticated container orchestration, many independently deployed services, Kubernetes operators, advanced workload scheduling, or Kubernetes-native tooling.
But not every application reaches that level of complexity.
If a project mainly needs:
  • automatic scaling,
  • health checks,
  • self-healing,
  • rolling deployments,
  • monitoring,
  • and rollback,
then native AWS services may already provide most of the required capabilities.

The Interesting Part

The biggest lesson from this idea is that we do not always need to rebuild the difficult parts.
AWS already knows how to launch instances.
AWS already knows how to distribute traffic.
AWS already knows how to detect unhealthy targets.
AWS already knows how to replace failed capacity.
AWS already knows how to scale infrastructure.
The interesting DevTools problem is therefore not building another complete orchestration platform.
It is building a small, useful control layer that connects these existing capabilities and gives developers a much simpler workflow.
For smaller EC2 workloads, a combination of Go, the AWS SDK, EC2 Auto Scaling, Application Load Balancer, CloudWatch, Systems Manager, and a little Bash could provide a surprisingly capable deployment platform.
And that is the experiment I want to explore: how far can we simplify application orchestration by letting native AWS services do most of the heavy lifting?
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article