DevOps Basics: Infrastructure as Code

Hello Folks,WP_20150604_001

Last week in Toronto, we ran our first DevOps hackathon. It brought together developers and IT Pros in an effort to promote collaboration that will enhance their enterprise’s ability to be agile and achieve the following benefits:

  • Ship code faster
  • Improve IT performance
  • Suffer less outages/failures

One of the linchpins of DevOps is to treat Infrastructure as code.

“Treating infrastructure as code is a key element of DevOps, and it benefits both teams. Developers become more involved in specifying configurations, and Ops teams get involved earlier in the development process. Whether you are a developer or operations professional, you should understand and share your knowledge of and experience with infrastructure as code (IaC) with your colleagues.”

Infrastructure As Code: Fueling The Fire For faster Application Delivery
Forrester Infrastructure-as-Code whitepaper

IaC, What is that??

the best description I have seen is the following:

Infrastructure as Code is a set of techniques and practices which help IT Pros remove the burden associated with the day to day build and management of modular infrastructure. It allows IT Pros to build and maintain their modern server environment in a way that is similar to how software developers build and maintain application code.

you can find this as part of a post on deploying a VM with Chef.

Is it Complicated?

No, it’s not. it can be intimidating for IT pros to think about code but we do it all the time with scripts of all kinds. We need to remember that IaC is nothing but a way to define all the parts you already know in a way that can be deployed automatically over and over without the fear that the results will differ (we all know that if you ask 5 IT pros to deploy a server as per a build sheet, we will get 5 slightly different servers.)

How do I get started?

There are different ways to get use IaC. each with pros and cons. (I’m not jumping in THAT discussion because the pros for some of us are cons for others…) let’s just say there are multiple ways to get there.

  • Visual Studio
  • Azure Portal
  • PowerShell

Today, we will look at deploying IaC with the Azure preview portal

Every application in the Gallery has a Azure Resource Manager templates behind it. That’s how we deploy stuff for you. Now you can build your own or use some repository of pre-made templates and modify them to fit your needs.

Let’s get started.

1- Browse to https://azure.microsoft.com/en-us/documentation/templates/ and look at the list of the different templates available. (there are other repositories for the templates and we will look at that in a future post).

image

2- Let’s move to the third Page and click on the first template. (this one will deploy a simple Windows VM in West US with empty data disk)

image

3- This will bring us to a page that describes the template in details (1- Listing of all the parameters needed and 2- allow us to deploy it in Azure).  Click on Deploy to Azure.

image

4- The Portal page will show you 2 blades.  the first one (no 1) will allow you to provide the details for each parameters and the second (no 2) will show you the template itself and allow you to modify it if you need.

image

5- Next we will click on Edit Parameters (1). It will bring up a blade that allows you to enter the details needed (2) such as newStorageAccountName, adminUsername… (notice how they are the details in the template above)

Once you have entered the info, click OK

image

6- Next we will define the Resource Group we want to deploy in. you can create one or use an existing one. I will create a new one since I don’t have any configured in my current subscription by clicking Or create new (1) Once I entered the new name for my resource group we will click on Resource group location   (2) and select where we want this group to reside. I picked West US since the template is designed to deploy in that region. (we will look at modifying templates in a future post)

image

7- and click Create to start the process.

image

The portal will now show you on the dashboard (since the pin to dashboard checkbox was selected in the last step) the status of deploying in West US a D1 VM with an empty 10Gb data disk.

image

Once the process completed you can Browse (1) your Resource Group (2) called iactestwestus (3) and notice that your VM with an attached disk has been created.

image 

You have now deployed your first IaC template. There is a lot more that is possible with IaC. we will look at all of it in future posts.

Cheers!

Signature

Pierre Roman
@pierre.roman