What is the deal with infrastructure-as-code, why does it matter to you?
Infrastructure-as-code, governance-as-code, and other “as-code” terms all deal with a set of desirable properties and outcomes. These properties and outcomes include getting consistent, reliable, repeatable solutions of some kind - with (relatively) fast feedback and delivery.
If you run business solutions at a cloud provider such as Amazon Werb Services (AWS), this will matter to you.
For infrastructure-as-code, this typically means to quickly and reliably set up and update (cloud-based) infrastructure. This infrastructure is the IT foundation that many business solutions depend on to run in a good way.
Thus it is a benefit to handle this consistently and reliably. If business expands or disaster strikes - also have the whole process repeatable and quick.
What as-code means
The term “as-code” in infrastructure-as-code may lead you to think it is about writing computer software to build infrastructure.
While this is certainly one way of doing it, the term “as-code” is a kind of abbreviation of “where we use good software engineering practices to produce great outcomes for the business.” But infrastructure-where-we-use-good-software-engineering-practices-to-produce-great-outcomes-for-the-business is a bit of a mouthful, so the short form “as-code” stuck instead…
What kind of good software engineering practices are we talking about here?
- Provide a human-readable and precise description, without ambiguity
- Keep track of changes in these descriptions, so we know what changed and who changed it
- Keep a version and release history of changes, with meaningful labels
- Allow us to see what state of the descriptions were at a specific time or associated with a specific label
- Be able to perform tests against an infrastructure description, to validate key elements of the descriptions
- Have computer software that can parse and execute the content of the infrastructure descriptions, to produce desirable outcomes
- An organizational structure that supports a way of working that fits with these concepts
Note here that only the second to last bullet point mentions computer software. Instead, it is mainly about practices that allow us to keep track of what we do efficiently. In addition, It is also about to allow the use of software tools to make this type of work more efficient, faster and eliminate human errors as much as possible.
One type of description I mention is certainly programming language code, as it has some desirable properties. But it does not have to be that.
For the most part, it will boil down to a textual infrastructure description, since this is something both humans and computer software tools may handle reasonably well.
Another vital part, sometimes overlooked, is that working with these tools and processes needs to be supported by the way people work and organize. If not, it is going to become messy no matter what.
What tools to use with as-code solutions
A vital tool is a version control system (VCS). It is also called a software configuration management (SCM) tool. Today, the most popular tool in this space is probably git, but there are many other tools also. Multiple hosting services can help you store and manage data using git - three prominent ones are Github, Gitlab, and Bitbucket.
Any tool that can create and edit text is valid to write the infrastructure descriptions. These tools could be anything from Notepad on Windows to more advanced tools, such as Jetbrains Intellij IDEA.
A useful set of tools that comes up a lot are those associated with Docker, which is a way to package (application) software to be provisioned to the infrastructure.
Tools to describe my infrastructure
Vital tools to work with infrastructure-as-code are the tools that understand the infrastructure descriptions. The examples here focus on Amazon Web Services (AWS) cloud infrastructure. Tools such as Terraform, Pulumi, and CDKTF work with other providers also. Common tools include AWS Cloudformation and Terraform, which uses textual configuration descriptions to describe the infrastructure. These can go into quite a bit of detail, which means they are very versatile. However, these tools can also get complex to use.
We also have tools that involve actual programming language code, such as AWS Cloud Development Kit (AWS CDK), Pulumi, and Cloud Development Kit for Terraform (CDKTF). All these allow infrastructure to be defined and described using programming languages. For developers who are used to coding, this can be great.
What tools should I pick?
I would argue that for the tools that describe the infrastructure, there may be four groups of people:
- Developers, who only want to care about application solutions, not the infrastructure it uses
- Developers, who want to care about the infrastructure
- Operations and sysadmins people, who care about the infrastructure, and does not consider themselves developers
- Other people
If you have people that fit all bullet points, you could pick any of these tools. The CDK + Pulumi tools should have some persons that fit the developer-who-cares-about-infrastructure to be a good choice. They can provide support for the other groups using these tools.
Operations and sysadmins people may consider AWS Cloudformation and Terraform as options, unless they want to dive into learning programming more in-depth.
Developers who mainly want to focus on application solutions may be served better by AWS AppRunner and AWS Copilot if they do not have the support from other groups - if their use cases fit these tools. This is probably the starting point for the “other people” group also if the other groups are not there to support them. However, there is still a need to understand the application software to run, so the “other” group will need some additional support - or prepare to learn some of the skills of the other groups.
What to do next
Start with tutorials for the simpler tools, like AWS AppRunner or AWS Copilot - the latter can even deploy AppRunner solutions as well. Pick a hosting service for version control system software, and get familiar with it. I would suggest starting with Github, even if this is not what you will use in the end. Github is the largest hosting service on the market, so there is plenty of example for it. Plus, you can sign up for free and use it.
For AWS CDK, the site https://cdkworkshop.com is a good start.
Terraform and CDKTF has some starter material at https://learn.hashicorp.com.
Pulumi has a few tutorials at https://www.pulumi.com/docs/tutorials/.
More references and articles to come, keep an eye here for updates!