Cloudoff
Cloudoff is a lightweight Go application that automates EC2 instance management to cut your AWS bill: stop at night, start in the morning, and terminate instances that have outlived their lifetime. Everything is driven by EC2 tags — no central configuration to maintain.
| Role | Stop, start and expire EC2 instances, driven by tags |
| Stack | Go · AWS EC2 |
| License | Apache-2.0 |
| Image | bananaops/cloudoff |
| Helm chart | bananaops.github.io/cloudoff/ |
| Repository | BananaOps/cloudoff · releases |
Features
Section titled “Features”- Scheduled stop and start of EC2 instances (for example, stop at night, start in the morning)
- Automatic cleanup of instances once their TTL has expired
- Cost optimisation by limiting the uptime of non-critical resources
- AWS best practices: tag-based selection, IAM roles
- Prometheus metrics through an optional
ServiceMonitor
Prerequisites
Section titled “Prerequisites”- Go 1.18+ (to build from source)
- AWS credentials with EC2 management permissions (environment variables or IAM role)
- Tagged EC2 instances (see below)
EC2 tags
Section titled “EC2 tags”Cloudoff only manages instances that carry these tags. They are the heart of the configuration.
| Tag | Example | Role |
|---|---|---|
cloudoff:uptime | Mon-Fri 08:00-20:00 Europe/Paris | Window during which the instance must run. The time zone is required. |
cloudoff:downtime | Sat-Sun 00:00-23:59 Europe/Paris | Window during which the instance must be stopped. Takes precedence over uptime when they overlap. |
cloudoff:ttl | 3d, 12h or 1w | Instance lifetime. Units: h (hours), d (days), w (weeks). |
Installation
Section titled “Installation”helm repo add bananaops-cloudoff https://bananaops.github.io/cloudoff/helm repo update bananaops-cloudoff
helm install cloudoff bananaops-cloudoff/cloudoff \ --namespace cloudoff --create-namespacedocker run --rm \ -e AWS_REGION=eu-west-3 \ -e AWS_ACCESS_KEY_ID=... \ -e AWS_SECRET_ACCESS_KEY=... \ bananaops/cloudoff:latestgit clone https://github.com/bananaops/cloudoff.gitcd cloudoffgo build -o cloudoff./cloudoffConfiguration
Section titled “Configuration”Helm values
Section titled “Helm values”image: repository: bananaops/cloudoff pullPolicy: IfNotPresent tag: ""
serviceAccount: create: true annotations: {} # put the IRSA annotation here on EKS
securityContext: runAsNonRoot: true runAsUser: 1000
resources: limits: cpu: 250m memory: 128Mi requests: cpu: 250m memory: 128Mi
prometheus: monitor: enabled: false # set to true if Prometheus Operator is installedAWS authentication
Section titled “AWS authentication”On EKS, the recommended approach is IRSA: create an IAM role with the required EC2 permissions and annotate the ServiceAccount.
serviceAccount: create: true annotations: eks.amazonaws.com/role-arn: arn:aws:iam::000000000000:role/cloudoffOutside EKS, Cloudoff reads the standard AWS credential chain: environment variables, profile, or instance role.
-
Tag the instances to manage
Terminal window aws ec2 create-tags --resources i-0123456789abcdef0 \--tags Key=cloudoff:uptime,Value="Mon-Fri 08:00-20:00 Europe/Paris" -
Deploy Cloudoff in the target account or cluster (see Installation)
-
Check the logs to confirm the detected instances and scheduled actions
Terminal window kubectl logs -n cloudoff deployment/cloudoff
Example windows
Section titled “Example windows”# Office hours, weekdays onlycloudoff:uptime = "Mon-Fri 08:00-20:00 Europe/Paris"
# Forced shutdown at weekends, even if uptime overlapscloudoff:downtime = "Sat-Sun 00:00-23:59 Europe/Paris"
# Ephemeral test environment, terminated after 3 dayscloudoff:ttl = "3d"