Lesson 3: Infrastructure as Code (IaC)

Because all services offered through the major cloud providers are exposed via APIs then you can start to codify your infrastructure.

To explain this in more detail lets look at the different ways we can build a server in AWS. AWS servers are called “EC2 instances” (ECC stands for Elastic Compute Cloud). Once you have an account you can use your browser to visit a console where you can click on a button to build your server. The form will ask you a bunch of questions and then Amazon will build the virtual server for you.

However Amazon also allow you to build your server from the command line. You can download the AWS SDK or you can use the CLI.  These tools will allow us to write code that can be executed to build whatever we need. There are other tools (such as Ansible and Terraform) that can add a level of abstraction and simplification to this process.

Once all of your infrastructure is built as code things start to change in the way the infrastructure is managed. We can start to introduce all the good practices that developers have been using for years to manage code. Simple things such as versioning, keeping backups of previous versions, extensive in-line commenting to name but a few.

Our code can tell our Cloud Service Provider (CSP) what to build but also tell us what we have built removing the need to continually update a database  that references our complex environments. Infrastructure change becomes easier to manage as we can roll back to a previous version in minutes.

But our code can do even more than this. Our code can include references that allow automatic scaling of services. However that demands an understanding of the subject of elasticity and at this point its probably worth reviewing the 10 principles of a good Cloud strategy.

Contact Page