Azure VM auto scale based on alert - azure

The scenario is as follows:
In company premise, there is a network that consists few machines.
The company has an Azure subscription.
Requirement:
To monitor the company's Network/Machines via Azure
If the company resource goes beyond a threshold limit then trigger alerts. Example, network bandwidth consumption, machine CPU/Memory usage, etc.
When such alerts occur then spin up new virtual machines or VM scale sets in Azure to handle the load.
The purpose is if the machines in on-prem goes above threshold limit then automatically provision VMs in Azure, as there are only few on-prem machines.
Please guide how to implement these use cases?

your question is a little confusing. You mention machines on premises and using Azure to monitor them. You can monitor on premises VMs using Azure but then you mention provisioning new Azure VMs via Scale Sets.
I'm not 100% where your workload is but assuming it is in Azure then if you are using VM Scale Sets it's very easy to scale in and out based on resource utilisation.
This can be configured as described here: https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-autoscale-portal

Related

How to schedule to change VM resources in azure?

I have 4 VMs in azure and I am trying to set up a schedule to lower the RAMs and CPU cores for after-hours and revert them back to their original size during business hours.
can someone guide me through the steps or share a how-to resource, please? I can't find any documents and I am sure my search key is not correct.
Thanks
As suggested by #harshavmb, you can make use of VMSS.
In Azure, Auto-Scaling is possible if you make use of Virtual Machine Scale-Sets.
Virtual Machine Scale-Sets allows you to automatically scale as resource demand changes.
Based on schedules, you can create auto scale rules.
These schedule-based rules allow you to automatically scale the number of VM resources at fixed times.
To create the Auto-Scale rule, you can make use of following tools:
Azure PowerShell
Azure CLI
Azure template
Otherwise, you can create an automation account in Azure and execute runbooks as mentioned in below link if helpful:
Automatically Resize an Azure VM - Automation account

Azure Advisor - Virtual Machine Scale Sets

Out of the box, Azure Advisor includes Cost recommendations for the resource type of Virtual Machines, based on resource utilization.
If I look at them under our subscription they have the following information:
Is there any way to get similar advisory for the Virtual Machine Scale Set resource type? Is there any included out of the box?
Or if I want to get average resource consumption, of let's say CPU percentage of all or individual Virtual Machine instances inside of a Virtual Machine Scale set, to be able to aid in the decision if the SKU of the Virtual Machine Scale Set is appropriate, I need to make a query for this inside of Monitor Logs or similar?
Could one create their own custom made advisories (inside of Azure Advisor, if not - anywhere else?), to get this functionaltiy in place (if it isn't already provided)?
Thanks!
Is there any way to get similar advisory for the Virtual Machine Scale Set resource type? Is there any included out of the box?
As per the Azure Advisor documentation, Advisor provides recommendations for the following resource types:
Application Gateway, App Services, availability sets, Azure Cache, Azure Data Factory, Azure Database for MySQL, Azure Database for PostgreSQL, Azure Database for MariaDB, Azure ExpressRoute, Azure Cosmos DB, Azure public IP addresses, Azure Synapse Analytics, SQL servers, storage accounts, Traffic Manager profiles, and Virtual machines.
Although Azure Advisor also includes your recommendations from Azure Security Center which may include recommendations for additional resource types, this list does not cover cost recommendations for VMSS as of today, AFAIK.
I need to make a query for this inside of Monitor Logs or similar?
To monitor your Virtual machine Scale sets, you can leverage Azure Monitor. The performance views in the VM Insights feature are powered using log analytics queries, offering “Top N”, aggregate, and list views to quickly find outliers or issues in your scale set based on guest level metrics for CPU, available memory, bytes sent and received, and logical disk space used.
You can also deploy the Azure Monitor Application Insights Agent on Azure virtual machine scale sets to enable monitoring for your .NET or Java based web applications and get all the benefits of using Application Insights without modifying your code.
Could one create their own custom made advisories (inside of Azure Advisor, if not - anywhere else?), to get this functionaltiy in place (if it isn't already provided)?
Nope, that is not doable as of today. Azure Advisor is a managed offering that analyzes your resource configuration and usage telemetry and then recommends solutions that can help you optimize your Azure resources. Feel free to share your feedback and ideas here for the Advisor team to evaluate and prioritize.

Azure Auto Scaling

Is there an equivalent functionality in Azure like AWS Auto Scaling Group or GCP Instance Group? All I can find is Azure Virtual Machine Scale Set which always uses load balancer. The closest resource I found is Azure Automation Runbook which a bit more complex for my use case.
I just need to spin up virtual machines based on current vm's health threshold and/or to use it for vertical scaling by simply change the instance type.
You can create an Azure VMSS without a loadbalancer, you may need to assign a pubic IP addresses to your VM which is now available. In your case it sounds like you just want 1 node in the VMSS so you can use AutoScale.
https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-networking#public-ipv4-per-virtual-machine
The equivalent Azure service for AWS Auto Scaling Group or GCP Instance Group is Azure Autoscale.
I'll provide some basic overview on Azure's Autoscale taken from here.
Azure Autoscale supports the most common scaling scenarios based on a
schedule and, optionally, triggered scaling operations based on
runtime metrics (such as processor utilization, queue length, or
built-in and custom counters). You can configure simple autoscaling
policies for a solution quickly and easily by using the Azure portal.
For more detailed control, you can make use of the Azure Service
Management REST API or the Azure Resource Manager REST API. The Azure
Monitoring Service Management Library and the Microsoft Insights
Library (in preview) are SDKs that allow collecting metrics from
different resources, and perform autoscaling by making use of the REST
APIs. For resources where Azure Resource Manager support isn't
available, or if you are using Azure Cloud Services, the Service
Management REST API can be used for autoscaling. In all other cases,
use Azure Resource Manager.
The mentioned article is a great resource.
It also provides information about:
Types of scaling (Vertical Vs Horizontal).
Configure autoscaling for an Azure solution.
How to use Azure Autoscale.
Application design considerations for implementing autoscaling.
Check out also this resource on How to auto scale a cloud service.

Windows Services on Azure Virtual Machines with Availability Sets

I have few (around 10) Windows Services on my existing environment. We are planning to migrate to Azure with the following.
Host our database on Azure SQL Database.
Install all the 10 Windows Services in a Azure Virtual Machine. Please note that these Windows Services does bulk inserts into the Azure SQL databases.
Take 2 instances of VM (specified in #2 above) and configure them in an Availability Set to avail the SLA.
I have two questions.
Do I need to install all my 10 Services to both the VMs?
Will that NOT be reduntant running the Windows Services in both the VMs? So, the Bulk Inserts will be duplicated to the Azure SQL Databases.
Please let me know if I am thinking in the right direction or are there any alternate methods (like Worker Roles) of utilizing the existing Windows Services on Azure with minimum or no changes?
It looks like, I got an answer to my question. When there are two VMs in a given Availability Set, ONLY one will be up and running. The other VM will come into picture only when the primary VM is down.
Thanks,
Prawin
If you are to take advantage of Azures SLA you will need to have at least 2 VM's (from within the same family) in an availability set. The SLA covers the VM's in the availability set NOT what you are running on the OS. For example if you have all services running on one instance and that box goes down, you lose those services till the box recycles. Microsoft is still covered on their SLA because at least one of the VM's in the availability set is available.

How to autoscale virtual machines(IaaS approach) in azure

How to autoscale virtual machines(IaaS approach) in azure instead of web/worker role autoscaling in azure?
You can now Autoscale Virtual machines in Azure directly in the Azure Management Portal. ScottGu has a post about it on his blog.
The important thing to autoscale VM's is you must proactively provision the Max # of VM's you think you'll need to handle your peak capacity, and add them to the same availability set.
For example, if on the busiest day of the week it takes 6 machines to handle all of your traffic, then you need to create 6 instances and install your application on it, configure it to handle traffic etc.... and then add it to an availability set with the other 5 machines.
Once you've done this, you can navigate to the Cloud Service that contains all of your virtual machines and click on the Scale tab. You should see a list of your availability sets, and it should tell you the # of machines you can scale over. Choose a metric (either CPU or Queue today), and then range of machines you want to scale between. You can scale between 1 and the total # of machines.
When load is low -- Azure will turn off machines (so you don't have to pay for them), and when load is high, Azure will turn those machines back on.
Auto-scaling on the IaaS level doesn't really make sense. Even if azure could detect high CPU usage and start a new VM based on it, what then? you still need to install your application on that VM automatically somehow.
What you are looking for is something that runs your app on azure, and installs new instances on new VM's if necessary. That "something" is called PaaS enabler. Basically it is another abstraction level between your app and the azure IaaS.
there are a couple of them out there :
Cloudify, CloudFoundary, Juju
as far as i know, only one that supports Azure is Cloudify. you can check out how to configure azure using Cloudify here : Configuring Azure
you can also check out the community - Cloudify Forum, or post questions here for assistance.
Disclaimer: I work for Gigaspaces, developing the Cloudify product line.
According to this it's possible to scale out IaaS with Availability sets by pre-provisioning the number of boxes: https://blogs.msdn.microsoft.com/kaevans/2015/02/20/autoscaling-azurevirtual-machines/

Resources