If you have an autoscaling group in AWS, you have a need for Predictive Scaling.
Predictive Scaling is exactly what it sounds like: Machine Learning being applied to your auto scaling metrics through a service provided by Amazon. This service looks at metrics provided from your existing Auto-Scaling group metrics including CPU use or custom-defined metrics. These metrics are weighed against Amazon’s own data to build a forecast for resource usage by your EC2 instances.
The more data points available for machine learning, the better your results. AWS’s predictive scaling only requires 24 hours of data to start making predictions, but those predictions will get better the more data is available. Predictive Scaling is a free service and can be configured for predictions only which allows you to see the results of Predictive Scaling without making any commitments to change your infrastructure.
With Predictive Scaling on and in forecast-only mode, you can see Amazon’s predictions for your future resource use.
How to turn on Predictive Scaling
First, you will need to open up the Autoscaling Wizard and locate a cloud formation or auto-scaling group to apply Predictive Scaling to.
Next, you will be taken to a menu to configure and name your autoscaling plan. From here you can choose metrics you want to use, and what you are trying to optimize for: Cost, Performance, or both. Under the ‘Configuration Details,’ you can set the scaling mode to ‘Forecast’ rather than ‘Forecast and scale’. This will prevent Predictive Scaling from making adjustments to your setup, so you can view the Predictive Scaling predictions without having to commit to infrastructure changes. You can always revisit this later and enable it when you’re ready to do so.
From this menu, you can also customize which metrics your Predictive Scaling policy is looking at. Just like with Cloudwatch, you can include AWS metrics such as CPU usage or you can include custom metrics that have already been configured for Cloudwatch collection.
Predictive Scaling will need 24 hours to gather enough data to start making predictions. After that, plans are updated daily and include a forecast for the next two days.
Currently, Predictive Scaling only supports EC2 instances and is only available in the US, Europe, and the Singapore AWS regions. AWS has also committed to expanding this service to more regions and products in the future.
When you’re comfortable with the predictions being made by the Predictive Scaling service, then you can switch your Predictive Scaling policy to ‘Forecast and Scale’ to allow this policy to manage your EC2 instances. This will allow the policy to scale-out and scale-in instances based on future predictions. This helps cut costs through right-sizing just like an auto-scaling group policy, and also helps with scaling out before demand hits to ensure services are delivered without anyone having to experience a slowdown as new instances are spun up to handle demand as those instances will already be in place ahead of time.