How to create a scalable stack from a snapshot or image (of a running Droplet)Every systems administrators dreams of having a fully automated infrastructure with elastic capabilities. Such an organic environment would avoid resourceshortages . It would ensure that everything runs on High Availability environments while guaranteeing the highest user experience possible. And, a sysadmin would never loose a visit.
With ECmanaged sysadmins can control their Cloud expenditure and lower their workload. They just have to follow a few simple steps to set up an autoscaler .
We all know you need 4 things to set up an autoscaler; be able to autodeploy, have a load balancer, monitor your platformand define a scaling logic. ECmanaged will make it possible for sysadmins to have an autoscaler even if their Cloud provider does not fulfill one of the 4 key elements.
The ECmanaged autoscaling feature is particularly interesting in a Digital Ocean environment The autoscaling can also be set up in a multi-Cloud scenario combining the strengths of different providers (like using SSD disks).
This tutorial will look into creating an autoscaling process using Digital Ocean droplets. We will start from a snapshot (or image) of a running cloud server . A “stack” is the entity that includes all the characteristics and preferences needed to deploy automatically one or more droplets or Cloud servers. A stack is “scalable” when it has an enabled scaler containing scaling preferences so it can grow and decrease dynamically.
The whole process to create the autoscaler takes just 3 steps.
Step 1: Creating an image of the droplet
We will use an already functional, customized droplet as a basis to construct our scalable infrastructure. Select the droplet you want to make the image of, and click on “Create Image” in the “Action” menu.
A form will pop up. Define the “Image Name” and give it a short description. We´ll call it “MYLAMP_IMAGE” in our example. Some providers will allow you to make the image without stopping the Cloud server. This depends on your provider. With Digital Ocean: it allows to make image without stopping? Now click on “Create”. Congratulations, you have already created the image of your droplet.
Step 2: Create a scalable stack
You need to create a stack which includes all the characteristics and preferences needed to deploy droplets or Cloud servers automatically as well as the scaling preferences. Go to “My Platforms”, access the “Stacks” section and click on “NEW STACK”. A pop up window will appear to guide you through the various steps to configure the stack.
First step: Properties. Here you must define a name for your stack and select one of the different options to deploy the droplets inside this stack.
♦Simple: Builds a server from a provider or private OS image.
♦Application: Builds your Cloud server based on ready-made applications.
♦Customized: Creates a server from a base operating system and the recipes you want to apply.
♦Image: Builds from an image from another Cloud server, provider images, or public images.
♦Backup: Builds a server from a backup image.
♦Template: Use your own defined templates or third party ones to build your server.
We will use the “Image” option to build the servers from our own image. Ok, next step. Choose your provider (Digital Ocean in our example), its region, zone and size. Then you continue to the next step. Select the “MYLAMP_IMAGE” under “My Images".
In the “Deployments” section you can add scripts or recipes to be deployed at different stages of the lifecycle of your Droplets or Cloud servers. We will not do this in this example and will jump to the next section. The same applies to the “Variables” section. Just continue to the “Security” tab.
Select your security key or generate a new one, set the notification profile, firewall ,etc. Here you can also define tags and enable the monitoring.
Now you have reached the most important step to set up a scalable stack; defining the load balancer. Digital Ocean does not provide its droplets with a load balancer. Being able to activate one through ECmanaged is a real benefit. The balancer will allow you to grow your platform. Select your balancer and save your new stack.
Now you have a stack that will deploy servers based on the image and will add them to the selected load balancer.
Step 3: define the scaler settings
All we have to do now is define the scaler settings. To do so, you need to access your newly created stack and select the “Scalers” section. Click on “NEW SCALER” and follow the popup wizard.
First you should name the scaler and select your stack as “Scale Target” so the scaler actions will be applied to it. In the “Options” tab you define the scaler´s behaviour. ECmanaged allows you to set a minimum and maximum number of droplets to avoid unlimited growing.
ECmanaged uses a system of votes before actions are carried out. Votes are useful to avoid scaling for temporary high loads for example. You would want to grow you platform only when the load is sustained on time. By using the throttling section you can define ramps to grow and decrease. The “Save Money” option is intended to get the maximum yield from scaled servers. Some providers charges are on a per hour basis so adjusting this option will maximize your benefit. I you pay for an hour, drain it!
In the last step, called “Triggers”, you define what needs to be checked to decide when to go up or down. Trigger types can be based on:
♦ Capacity: CPU, RAM or disk
♦ Scheduled: Define what to do per day. For example, scale up on Mondays at 8:00 and scale down on Friday 20:00.
♦Date and time: For a single time scaling. Useful when future load is predictable.In this example we will use “Capacity” as a trigger type. Next you need to choose the “Trigger Source”. This means what will we checked before deciding a scaling. Usually you will want to check the same stack where the scaler is located but you can also use a different stack or Cloud server. For example: a database with separated fronts scenario. There we might need to scale the DB stack up rather than the front stack. In this example we want the scaler to check the stack where the scaler is located.
Now let's define the conditions to base our scaling on. We selected a CPU with 80% to scale up and 60% to scale down. We use the same limits for the memory usage. These capacity values are calculated as an average of all the members of our stack. Finally, you need to select how the scaling should happen; by voting or immediately.
That´s it. Your autoscaler is fully operational now and you are able to Autoscale your stack.
ECmanaged really helps you take control of your Clouds. You can see your new scaler in the stack menu.