Posts

Showing posts with the label Autoscaling

Auto Scale Fargate Service Based On SQS ApproximateNumberOfMessagesVisible

Answer : Yes you can do this. You have to use a step scaling policy, and you need to have an alarm created already for your SQS queue depth (ApproximateNumberOfMessagesVisible). Go to CloudWatch, create a new alarm. We'll call this alarm sqs-queue-depth-high , and have it trigger when the approximate number of messages visible is 1000. With that done, go to ECS to the service you want to autoscale. Click Update for the service. Add a scaling policy and choose the Step Tracking variety. You'll see there's an option to create a new alarm (which only lets you choose between CPU or MemoryUtilization), or use an existing alarm. Type sqs-queue-depth-high in the "Use existing alarm" field and press enter, you should see a green checkmark that lets you know the name is valid (i.e. the alarm exists). You'll see new dropdowns where you can adjust the step policy now. This works for any metric alarm and ECS services. If you're going to be trying to scale this...

AWS Beanstalk Auto-scaling Scaling Triggers With HealthyHostCount Or UnhealthyHost Count

Image
Answer : Change that first option "HealthyInstanceCount" to UnHealthyInstanceCount and if there's 1 or more unhealthy, add +1 instance. If UnHealthyInstanceCount is 0, add -1 instance (take one away). Make sure your minimum is set to 1 or more (it is recommended 2 minimum, in two separate availability zones for High Availability). Following up on this as I just had the same problem. The solution proposed by @Max is on the right track, but a slight tweak on the numbers is needed. 1) Ensure minimum instance count and maximum instance count are set as precautions 2) Set the following parameters Trigger Measurement: UnHealthyHostCount Trigger statistic: Maximum Unit of measurement: Count Upper threshold: 0 Upper breach scale increment: 1 Lower threshold: 1 Lower breach scale increment: -1