Auto-scaling stacks

About auto-scaling stacks

Auto-scaling stack is one of the features showing power of the platform in real life. Auto-scaling stack leverages multiple services of the platform, working together on a common goal. With auto-scaling stack, you can easily build infrastructure for a multi-tier application in few simple clicks - creating a load balancer in the front, connecting instances as members to that load balancer, and automatically scaling the whole stack up and down depending on the workload.

Applications that needs to store data (such as files or records) will additionally need to have some storage back-end connected - such as a database, or object storage. While such a back-end is not a part of the auto-scaling stack, it is also very easy to build and connect separately.

Building and managing auto-scaling stacks

When creating an auto-scaling stack for a practical purpose (such as building an application that can scale up and down automatically), you can control the auto-scaling behavior (instances size and quantity, auto-scaling triggers and threshold, etc) via the stack settings. However, another important part that should be taken care of is configuring the instances themselves to make sure they are ready to work in the application stack. Let's consider the options available there.

Preparing instance image and configuring instances in an auto-scaling stack

An auto-scaling stack is designed to run fully automated and unattended. The decisions to deploy new instances when load goes up or to delete some extra instances when the load goes down will be made by the platform itself in fully unattended mode. That means that as a user, you won't have an opportunity to configure components of the stack after they are deployed - they must be configured automatically and ready to go immediately after the deployment.

There are two ways to prepare your instances to participate in an auto-scaling stack.

First, you can prepare the instance as required in its final configuration (manually - by logging in, deploying and configuring required applications, etc), and then take a snapshot or image of that instance, and use that created snapshot or image to deploy the stack.

Second, you can make a "bootstrap" script to configure a stock instance built from an existing image, and specify this script during the stack creation. Every time when a new instance is created and added to the stack, the platform will run this script on the instance, and will execute commands from the script.

Note that there is no guarantee that the execution of the script mentioned above will begin when instance configuration is fully completed (services are up, networking is operational, etc) - so, if your script depends on these condition, make sure that verification and waiting for these conditions is a part of the script, too.

And of course, you can use a combination of these two - both custom image and a configuration script.

Launching an auto-scaling stack

To create a new auto-scaling stack, expand the "Stacks" section in the left-hand navigation menu, and click on "Auto-scaling stacks". Then, click "Create an auto-scaling stack" button.

You can configure the following settings:

  • Name of the stack.

  • Image of the instances that will be used to build new servers in the stack. You can choose an image or a snapshot.

  • Flavor defining the instance size and performance.

  • Key pair to upload to the instances, which will allow you to log in to the instances for debugging and troubleshooting.

  • Network configuration of the stack - which includes instance networking, instance and load balancer port, and load balancer protocol.

  • Scaling parameters: metrics to monitor (you have a choice of CPU % usage, disk . activity or network activity), and "acting" thresholds for those metrics. There are two thresholds: one for scaling up (when the value exceeds the threshold for configurable period of time, new instances will be added, up to the max limit), and for scaling down (when value is below that threshold for the same period of time, instances will be removed, one by one - either untill the parameter value will be between the thresholds, or minimum number of instances is reached).

  • Minimum and Maximum number of instances in the stack.

Note that when multiple instances are deployed reacting on auto-scaling events, your account will be charged accordingly to the number of instances used. For more details, consult the billing section.