Now we have the skeleton of our application built and we're trundling ahead with building out the core features. It's time to consider our infrastructure once more.

We're deploying to our environment via our CircleCI pipeline. However, that environment was originally set up manually and was never going to be the final home for our app.

We need to define our infrastructure as code (IAC). These days in any modern application stack having your infrastructure defined as code is commonplace and there are some huge benefits in doing so:

  • Minimise the risk of the entirety of your knowledge about your infrastructure when the guy who set it up walks out the door.
  • Consistent infrastructure configurations between environments. Integration, development or production. They will all line up.
  • speed to deploy a new environment. It's now as easy as bashing out a few commands in your terminal. Compared to the previous experience of spending hours digging around in a UI for the right input to check on.

As time is money, less time spent configuring a new environment each time is good news for the bottom line!

Several technical solutions could satisfy our thirst for IAC. Terraform is one of the most popular but our preferred solution is called Pulumi which coins itself as "modern infrastructure as code" and we have to agree.

The biggest difference between Pulumi and Terraform is that with Pulumi you can define your infrastructure using languages you already know such as Javascript, Typescript, Python, Go and C#.

We were initially sceptical about the use of standard languages. Terraform has always preached about why it wasn't possible to offer higher-level language features. We were pleasantly surprised not to come across any of these shortfalls so far.

The fact we could define our infrastructure in Javascript is one of the main reasons we chose it. Anybody picking up the project wouldn't have to learn a new language just to make changes to the infrastructure. It also has; awesome documentation and connects to AWS.

The original code for our infrastructure was written in the pub (check out the full story here). We later refined it further. It turns out despite our best efforts and contrary to popular belief, a few pints does not sharpen the sword.

So far so good, We're about halfway through being able to deploy our MVP. For the next few weeks, it will be head down crunching out the rest of the app.

Pulumi example: