So for EB that is sitting idle (used only during development), just as EC2 can be scaled down to 0 instances, how can the load balancer be toggled off (and later toggled back on)? Could Terraform be employed, such that the absence of the ALB is detected and gets recreated with an apply?
I already terminate EC2 instances under EB when idle, but all the while my unused load balancer is charging me! Ideally I'd have a zero cost during idle time, by also deleting the load balancer. But when I go to recreate the ALB when needed, Terraform state isn't explicitly tracking the ALB (it's managed by EB environment), so it doesn't get recreated.
I know Elastic Beanstalk environments can be created without load balancers. I'm hoping the "scalability" of AWS provides a cleaner and faster approach to just toggling the existence of the load balancer besides recreating the whole EB environment.
You can temporarily disable all Elastic Beanstalk infrastructure that costs money, allowing you to suspend the application for free until you're ready to turn it back on, without the expense of destroying and recreating it from scratch.
Via the EB Environment Configuration:
Capacity
Environment type: load balancing, auto scaling
Single-Instance Environment
0
instancesLeave running for months this way, without paying a dime...
Then, You can turn everything back on the way it was quickly:
terraform refresh
to import the new instance ids of your autoscaling targetsplan
, apply
)