12 Cost of cloud computing

 

This chapter covers

  • Investigating cost drivers for cloud cost
  • Comparing cost-optimization practices
  • Implementing tests for cost-compliant IaC
  • Calculating an estimate for infrastructure cost

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.

12.1 Manage cost drivers

12.1.1 Implement tests to control cost

12.1.2 Automate cost estimation

12.2 Reduce cloud waste

12.2.1 Stop untagged or unused resources

12.2.2 Start and stop resources on a schedule

12.2.3 Choose the correct resource type and size

12.2.4 Enable autoscaling

12.2.5 Set a resource expiration tag