Beaty Consultancy - What is Infrastructure as Code

What Is Infrastructure as Code

We spoke about disposable infrastructure last week, and about how we shouldn’t name our servers anymore.  The natural extension to that thought is Infrastructure as Code, which gives our cloud platform consistency, an audit trail, and a version history.  How how does it work?  How do you create it?  Let’s jump in!

What is Infrastructure as Code?

Infrastructure as Code is more like a script than actual code.  It’s a set of instructions which the cloud platform can follow in order to build a platform to the exact specification you define.


It’s kind of obvious that if you run a script again, it will perform the same actions exactly again.  This becomes really important, though, when you think about deploying testing environments, or pre-production environments ahead of big software releases.

Imagine you have great big expensive production servers for all the load they need to accommodate, but you run smaller, cheaper, servers for testing.  That’s usually fine, but what if you could just deploy a test environment which is exactly the same as production which you can do your testing on, and then delete it and stop paying for it?  If your platform is build using Infrastructure as Code, that’s exactly what you can do.


Infrastructure as Code is usually committed to a source control tool, just the same as application code is.  So if you want to add another firewall rule, a DevOps technician will pull the latest version of the code, make their change, and then commit that change back to the shared repository.  If you then start to notice problems with the platform, and you know when the problems started, you can check back in the version history for the infrastructure code to see what changed.


There are some super cool tools around for managing code these days.  You can design workflows which send notifications and require approvals for code to be deployed, which is really handy when it comes to could platforms.  Imagine if the change control process was automated for your infrastructure?  With a code deployment pipeline and Infrastructure as Code, it could be!

But I Can’t Write Code

Neither can I.  I didn’t make this website because I don’t know enough PHP to bend WordPress to my will.  The good folks at KCS do though!  But aside from just plugging an awesome local business, I say this to make the point that even though I’m not a developer by trade, I can create Infrastructure as Code.  Yes, it is complicated, but so is Latin-American dancing, and you mastered that didn’t you?


Like with most cloud technology ideas, there are loads of ways to do this, and there isn’t just one right answer.

If you want to stick to the cloud provider you work with, then you might well never need to look past Powershell for Microsoft’s Azure, or CloudFormation for AWS.

But if you want to be able to deploy resources in different clouds from one set of scripts, you might look to a tool which can talk to lots of platforms, like Hashicorp’s Terraform.  That’s what we use!

We already mentioned source control, and believe me, you want source control.  You can use any source control you fancy, but we like BitBucket.

That’s a whistle-stop tour of Infrastructure as Code – sorry it was so brief.  There’s a lot to talk about, but from here it gets quite detailed in different areas, so you’re best talking to us to find out more!

Skip to content