Skip to content

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.

RoleStop, start and expire EC2 instances, driven by tags
StackGo · AWS EC2
LicenseApache-2.0
Imagebananaops/cloudoff
Helm chartbananaops.github.io/cloudoff/
RepositoryBananaOps/cloudoff · releases
  • 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
  • Go 1.18+ (to build from source)
  • AWS credentials with EC2 management permissions (environment variables or IAM role)
  • Tagged EC2 instances (see below)

Cloudoff only manages instances that carry these tags. They are the heart of the configuration.

TagExampleRole
cloudoff:uptimeMon-Fri 08:00-20:00 Europe/ParisWindow during which the instance must run. The time zone is required.
cloudoff:downtimeSat-Sun 00:00-23:59 Europe/ParisWindow during which the instance must be stopped. Takes precedence over uptime when they overlap.
cloudoff:ttl3d, 12h or 1wInstance lifetime. Units: h (hours), d (days), w (weeks).
Terminal window
helm repo add bananaops-cloudoff https://bananaops.github.io/cloudoff/
helm repo update bananaops-cloudoff
helm install cloudoff bananaops-cloudoff/cloudoff \
--namespace cloudoff --create-namespace
values.yaml
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 installed

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/cloudoff

Outside EKS, Cloudoff reads the standard AWS credential chain: environment variables, profile, or instance role.

  1. 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"
  2. Deploy Cloudoff in the target account or cluster (see Installation)

  3. Check the logs to confirm the detected instances and scheduled actions

    Terminal window
    kubectl logs -n cloudoff deployment/cloudoff
Terminal window
# Office hours, weekdays only
cloudoff:uptime = "Mon-Fri 08:00-20:00 Europe/Paris"
# Forced shutdown at weekends, even if uptime overlaps
cloudoff:downtime = "Sat-Sun 00:00-23:59 Europe/Paris"
# Ephemeral test environment, terminated after 3 days
cloudoff:ttl = "3d"