Gaurav Mantri's Personal Blog.

Me and My Boss – The Saga Continues With Basic Tier Azure Virtual Machines

Man, my boss is always on my case. After what I did with Azure Mobile Services with him, he’s always after me. So this Friday, he calls me up in his office and following conversation happens between us:

Boss: The Virtual Machines we’re hosting in Azure, we want to bring the cost of them down.

Me: Boss, but they’re already very low. You got per-minute billing, different VM sizes to suit your need and on top of that we can bring our MSDN license to Azure, what more do you want?

Boss: Agreed (Me: Score!!! First time he agreed with me). But see if we can further bring the costs down. I don’t care much for our actual production servers but see if we can do something about dev/test VMs we are running in Azure. Essentially see if we can get no-frills VMs in Azure for our dev/test scenarios.

For the first time, I could see his point. He makes a very valid point. But then, him being a boss it is my duty to defy him :) plus I know that like last time he will give me a task and forget about that. Furthermore, recently Microsoft announced a lots of changes during their //Build/ conference and I have to catch up on those so I thought “screw him” and let me focus on what new stuff has been announced.

So I came back and started going through all the announcements and stumble upon something called “Basic Tier” for Azure Virtual Machines. It kind of looked interesting me so I started reading some more about it. As I read through the information about this, I realized this is exactly what my boss is looking for. Essentially from what I understood, Virtual Machines running under basic tier are:

  • No frill Virtual Machines in the sense that they don’t provide “load balancing” and “auto scaling” though if needed you can bring your own load balancer. They are currently available for “General Purpose Instances” and not “Memory Intensive Instances”.
  • They cost less than your standard instances (at this time about 10 – 20% cheaper depending on the instance size you choose.

Man-o-man … Did I hit the jackpot again??? This is exactly what my boss is looking for. Thank You, Thank You Microsoft for saving me again! I can now barge into his room and proclaim to be a superhero who saved his day (and his butt) again.

Excited and all charged up, I walked up to his room. I was about to enter his room but I saw two guys sitting with him. Now let me tell you about these two guys.

First, is a “Developer Dude”. Like a child, he wants to do all by himself. If there’s an API, nothing gives him more satisfaction and pleasure than to write code for that API. It doesn’t really matter if there’re already tools available to do the work. He would still want to write code :). I knew if I went into the room right now and talk about this basic tier, he would ask me the question “How would I create Virtual Machines in Basic Tier using Azure Service Management API”?

Second, is a “IT Pro Dude”. Like all other IT Pros, he live in the world of PowerShell. I know that he has been using Azure PowerShell Cmdlets, and the moment I talk about this he would want to know how can do work with this basic tier by using them.

I wanted it to be my moment of glory and wanted to go in prepared for all the questions I could be asked, I came back. Tried to find answers to the questions that I know Developer Dude and IT Pro Dude and to my surprise the answers were rather simple. The functionality already exists and same stuff can be used. Confident enough, I walked back into boss’s room. Those two guys were still there.

Me: Boss, Recently Microsoft announced “Basic Tier” for Virtual Machines. They are perfect for our dev/test scenarios + we will save anywhere from 10 – 20% on our Virtual Machine pricing. One catch is that these VMs  don’t have “load-balancing” and “auto-scaling” feature and the other catch is that they are not available for “Memory Intensive” instances but that should be fine for the scenarios we’re considering.

Boss: That’s great! (I could see the shine in his eyes :)).

Developer Dude: But I use Azure Service Management API to create VMs. Do I have to use a new operation to create this basic tier VM? Where’s the API for that?

Me: (Confidently, as I already anticipated the question) No. You would still use “Create Virtual Machine Deployment” operation. The only change you have to do is when you want to create a basic tier VM, you just have to prefix “Basic_” to the VM size. So for example, you wish to create a “Basic Tier Medium Sized” Virtual Machine (or in other words “A2”), in the request payload you specify the value for “RoleSize” element as “Basic_A2”. I also handed him a sample request payload for creating a Virtual Machine which is included below.

     

<?xml version="1.0" encoding="utf-8"?>     

<Deployment xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">      

 <!--Your host service name-->      

 <Name>DemoVM</Name>      

 <DeploymentSlot>Production</DeploymentSlot>      

 <Label>DemoVM</Label>      

 <RoleList>      

 <Role i:type="PersistentVMRole">      

 <!--Your virtual Machine Name-->      

 <RoleName>MyWinVM</RoleName>      

 <OsVersion i:nil="true"/>      

 <RoleType>PersistentVMRole</RoleType>      

 <ConfigurationSets>      

 <ConfigurationSet i:type="WindowsProvisioningConfigurationSet">      

 <ConfigurationSetType>WindowsProvisioningConfiguration</ConfigurationSetType>      

 <!--Your Computer Name-->      

 <ComputerName>MyWinVM</ComputerName>      

 <!--Computer pass word-->      

 <AdminPassword>S0m3thing</AdminPassword>      

 <AdminUsername>AwesomeAdmin</AdminUsername>     

 <EnableAutomaticUpdates>true</EnableAutomaticUpdates>      

 <ResetPasswordOnFirstLogon>false</ResetPasswordOnFirstLogon>      

 </ConfigurationSet>      

 <ConfigurationSet i:type="NetworkConfigurationSet">      

 <ConfigurationSetType>NetworkConfiguration</ConfigurationSetType>      

 <InputEndpoints>      

 <InputEndpoint>      

 <LocalPort>3389</LocalPort>      

 <Name>RemoteDesktop</Name>      

 <Protocol>tcp</Protocol>      

 </InputEndpoint>      

 </InputEndpoints>      

 </ConfigurationSet>      

 </ConfigurationSets>      

 <DataVirtualHardDisks/>      

 <Label>bXlzdmMxZGlubzY=</Label>      

 <OSVirtualHardDisk>      

 <!--VHD address and source image name-->      

 <!--replace these two properties to avaliable value-->      

 <MediaLink>https://myaccount.blob.core.windows.net/vhds/abc123344.vhd</MediaLink>      

 <SourceImageName>a699494373c04fc0bc8f2bb1389d6106__Win2K8R2SP1-Datacenter-201403.01-en.us-127GB.vhd</SourceImageName>     

 </OSVirtualHardDisk>      

 <RoleSize>Basic_A2</RoleSize>     

 </Role>      

 </RoleList>      

</Deployment>     

IT Pro Dude: (Frantically browsing the Internet on his smart phone) …. Did they announce a new version of PowerShell Cmdlets just to support that? Man, now I have to go back and rewrite all my scripts. I tell you man, sometimes I wonder about Microsoft. Do they try to make our lives hard on purpose?

Me: Dude, Chill!!! Yes, the new version of PowerShell Cmdlets are announced but for this stuff to work you don’t really have to use it. You can still use old Cmdlets. So if you’re using “New-AzureQuickVM” Cmdlet to create a Virtual Machine, you would again prefix “Basic_” to the Virtual Machine . Again, for example, you wish to create a “Medium Sized” Virtual Machine (or in other words “A2”), in the request payload you specify the value for “-InstanceSize” parameter as “Basic_A2”. I gave him the command details.

New-AzureQuickVM -Windows -InstanceSize "Basic_A2" -ServiceName "DemoVM" -name "DemoVM" -ImageName "a699494373c04fc0bc8f2bb1389d6106__Win2K8R2SP1-Datacenter-201403.01-en.us-127GB.vhd" -Password "S0m3thing" -AdminUsername "AwesomeAdmin"

Developer Dude & IT Pro Dude: Man, Its’ Awesome!!! (Then both looked at me) What about you?

Me: (Considering I’m neither a developer nor an IT pro and a lazy bum) I got Azure Portal. The functionality is there on the portal so if I want to make use of it, I would simply go to Azure Portal and do it there.

Boss: (Already started working on cost spreadsheet and thinking how much his bonus will go up) Go on. Let’s start using the basic tier for our dev/test machines. what’re you waiting for?

Me: (Thinking) How about a thank you???

Summary

That’s it for this post. I hope through this (funny) story, I was able to convey the value proposition of this new feature. Jokes aside, I think Microsoft is making some really good progress on IaaS side and is evident from this change and many other changes announced recently.

As always, if you find some issues with the post please let me know so that I can fix it ASAP.

Cheers!!!


[This is the latest product I'm working on]

Comments

  1. I love your writing style Gaurav Sir !! It’s an interesting & informative read… funny a well :)

  2. what a wonderful boss he was t assign task and forgot about it

  3. Hi Gaurav,
    Thanks for such a nice post for creating a vm over azure. i want to asks you how can i create more than one virtual machines under same cloud service so they can communicate each other over azure using rest api. please have a look on my code. on
    second iteration it gives me 409 error code (conflict).

    public static void createNewVms(int numberOfVms) {

    //String userName=”dps”;
    String passWord=”P@ssw0rd”;
    String sourceLink=”0b11de9248dd4d87b18621318e037d37__RightImage-Ubuntu-12.04-x64-v13.5.2″;

    try {

    for (int j=2;j<=numberOfVms;j++)
    {
    String name="dpsdeploymentvm"+j;
    String label="dpsdeploymentvmlabel"+j;
    String userName="dpspc"+j;
    String roleName="dpsvmdeployment"+j;
    String hostName="dpspc"+j;
    String mediaLink="https://dopstesting.blob.core.windows.net/vhds/dpsvmpc"+j+&quot;.vhd";

    String url = "";
    url = String.format("https://management.core.windows.net/%s/services/hostedservices/cloudserviceusingjava/deployments&quot;, subscriptionId);
    String requestBody = "” +
    “%s” +
    “Production” +
    “%s” +
    “” +
    “” +
    “%s” +
    “PersistentVMRole” +
    “” +
    “” +
    “LinuxProvisioningConfigurationSet” +
    “%s” +
    “%s” +
    “%s” +
    “false” +
    “” +
    “” +
    “” +
    “ReadWrite” +
    “%s” +
    “%s” +
    “” +
    “” +
    “” +
    “”;

    requestBody = String.format(requestBody,name,label,roleName,hostName,userName,passWord,mediaLink,sourceLink);
    int createResponseCode = postRequest(new URL(url), requestBody.getBytes(), “application/xml”, keyStorePath, keyStorePassword);
    System.out.println(createResponseCode);

    }

    }

    catch (Exception e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
    }

    }

  4. Thanks Gaurav for the answer of previous questian
    But here is another problem bothering me.
    i want to add a certificate during the creation of vm so i could access vm without typing the password
    that’s why i modify the previous code presented in below to add certificate in vm but after the creation of machine,When i tried to access machine using public key i could not access it so i type the password and find location where the certificates suppose to be stored on vm machine (/home/dops/.ssh). But at given location there is no certificate stored. Could you please help me out for this what could be the problem.

    ” ” +
    “” +
    “” +
    “”+ 3DFCE60EB9EAAB9778BD1BE3C47BQEL5G618A390″+
    “/home/dops/.ssh/authorized_keys”+
    “”+
    “”+
    “”+
    “”+
    30B189CD6F44AA165A53653ERC7W52E9CC043AA9″+
    “/home/dops/.ssh/id_rsa”+
    “”+
    “”+
    “”+
    “” +

    For creation of certificate i am using following ref
    http://azure.microsoft.com/en-us/documentation/articles/linux-use-ssh-key/

Speak Your Mind

*