← Back to projects
Case study / Cloud automation

Environment Power Manager

A control plane for shutting down expensive non-production services outside working hours while preserving safe, predictable recovery.

ROLE
Architecture & implementation
STACK
Python, AWS Lambda, EKS, Terraform
STATUS
Production

Problem

Non-production environments often run continuously even when nobody is using them. The challenge is not simply switching infrastructure off: dependencies must stop in a safe order and return with their previous state intact.

Architecture

EventBridge Schedule │ ▼ Lambda Controller ├────┼────┬──────┐ ▼ ▼ ▼ ▼ ArgoCD EKS Aurora MSK │ ▼ DMS State snapshots ──► DynamoDB

Engineering decisions

  • Suspend reconciliation before scaling application workloads.
  • Persist previous replica counts rather than assuming defaults.
  • Make stop/start actions idempotent and retry-safe.
  • Expose manual status, start and stop operations for recovery.
  • Treat infrastructure dependencies explicitly instead of relying on timing delays.

Selected code

power_manager.py
def scale_workload(apps, namespace, name, replicas):
    body = {"spec": {"replicas": replicas}}

    return apps.patch_namespaced_deployment_scale(
        name=name,
        namespace=namespace,
        body=body,
    )

Keep snippets short. The surrounding explanation should communicate why the code exists and which failure mode it addresses.

Outcome

XX%
Lower non-production runtime cost
1 cmd
Manual environment recovery
0
Hard-coded workload replica assumptions