When you use a cloud provider, you get very excited at the ease of provisioning. After all, you can create a resource at the click of a mouse or a single command. However, the cost of cloud computing becomes a concern as your organization scales and grows. Your updates to infrastructure as code can affect the overall cost of the cloud!
We must build cost considerations into our infrastructure just as we build security into it. If you make your system and find out you overran your cost, you could break the system while trying to remove resources and reduce your cloud computing bill. In chapter 8, I recommended baking security into IaC like a cake. The cost of ingredients affects how many cakes we could bake, essential to know before you start.
This chapter covers the practices you can combine with IaC to manage the cost of cloud computing and reduce unused resources. You will find some high-level, general cost-control practices and patterns that I describe in the context of IaC. However, regularly apply these practices to re-optimize costs as your system evolves based on customer demand, organizational scale, and cloud provider billing.