I am trying to figure out the way to create a custom autoscale policy for autoscaling in AWS using boto. I saw that the scale out and scale in policies are defined using system dependent resources like CPU utilization. But I want the scale out/in policy to be defined in a way that it calls a REST API and compare the response with some values. How can I make it possible?
I am using CircleCi as CI tool. I have 2 ec2 instances running as CircleCi- builders. During the weekends we generally don't require 2 instances. So I need to autoscale with min 1 and max 3 ec2 instances. If there are builds in the queue I wan to spin up a new ec2 and if the queue is empty for more that say 2 hours I want to scale down to just 1 ec2 VM as circleci builder. I can get the builds in queue information using CircleCi REST API.