Home > OS >  Is there a way to start an Azure Virtual Machine when someone try to access it through its DNS name?
Is there a way to start an Azure Virtual Machine when someone try to access it through its DNS name?

Time:10-26

For context, we have an Azure Virtual Machine that we use to test our app before pushing the changes to production. This VM automatically shutdown every evening to save some money and energy. Is there a way to make it start when trying to access its DNS name (******.cloudapp.azure.com)? It would be better than starting it at a fixed time every morning but if it is impossible or too complicated, is there a way to make it start at a specified time?

CodePudding user response:

Starting the vm using events requires some changes in your architecture.

You can start a vm at fixed time using automation accounts. Look at this tutorial on Microsoft learn to accomplish your goal

https://learn.microsoft.com/en-us/azure/automation/automation-solution-vm-management-config

CodePudding user response:

If you had a firewall in front off your VM you could log the HTTP 404 events, then trigger a function that started your VM.

But it is not trivial and the firewall would add extra cost (it may be more expensive than your VM)

So the best way is probably just to start the VM at a fixed time.

If you need the VM permanently you could look into Reserved instances to save costs. It could save you upto 80% https://azure.microsoft.com/en-us/pricing/reserved-vm-instances/

  • Related