id author title date pages extension mime words sentences flesch summary cache txt cbeer-info-8395 blog.cbeer.info .html text/html 2502 242 61 Autoscaling AWS Elastic Beanstalk worker tier based on SQS queue length Since we're deploying this application within AWS, we're also taking advantage of the Simple Queue Service (SQS), using the active-elastic-job gem to queue and run ActiveJob tasks. Elastic Beanstalk provides basic autoscaling based on a variety of metrics collected from the underlying instances (CPU, Network, I/O, etc), although, while sufficient for our "Web server" tier, we'd like to scale our "Worker" tier based on the number of tasks waiting to be run. create a new CloudWatch alarm that measures the SQS queue exceeds our configured depth (5) that triggers the auto-scaling policy to add additional worker instances whenever the alarm is triggered; and, conversely, create a new CloudWatch alarm that measures the SQS queue hits 09 that trigger the auto-scaling action to removes worker instances whenever the alarm is triggered. And wire it up to the Beanstalk application by setting the aws:elasticbeanstalk:sqsd:WorkerQueueURL (not shown: sending the worker queue to the web server tier): ./cache/cbeer-info-8395.html ./txt/cbeer-info-8395.txt