You’ve made a terrific advance setting up your infrastructure in the cloud, but now, we can go one step further. Now, we’ll learn how to manage the infrastructure using code! Imagine the possibilities, you now have all the advantages of using code; you can version your infra, easily revert to a previous state, you can replicate your entire stack within a few minutes, you can even blame and fire someone that screws with your application in production (please, don’t do this). That and even more you can get with IaC.
This may seem like something really difficult, but believe me, if you have a solid understanding of your cloud provider, you are almost set.
For this challenge you will have to replicate what you did in the last challenge (Cloud basics) but using IaC:
-
Choose an IaC tool. Learn about the options out there to implement this, and choose the one that you like the most.
-
Implement all your infrastructure as code. Now, you must be able to destroy and create your infrastructure again using a single (or a couple of) command(s). Research and follow some of the best practices for the tool you chose (like the use of modules or the management of the state in Terraform). Now you don’t have any excuses to shutdown your infra at nights!
-
Always use a VCS! You can use the same repository that you use for the apps, or you can create a new one for this, or do both. Do whatever you think is best for the project!