liveBook · Manning

Cost driver

As explained in Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform

A cost driver is a resource attribute, usage characteristic, or operational factor that influences infrastructure expense.

Cloud infrastructure can become expensive as systems scale because infrastructure-as-code changes alter the bill. A cost driver is a factor or activity that affects total cloud computing cost. Identify these drivers before changing infrastructure, then use the findings to guide optimization and budget controls. section 12.0 section 12.1

Investigate cost drivers by:

  • Breaking the bill down by offering, such as compute, databases, messaging, storage, networking, and other services. section 12.1
  • Separating testing and production environments to reveal where inefficiencies or excessive resource footprints occur. section 12.1
  • Inspecting resource attributes such as server type and size, then controlling them with policy tests, right-sizing, reservations, or autoscaling. section 12.1 section 12.4
  • Repeating the analysis as customer demand, organizational scale, architecture, and provider billing evolve. section 12.0

Estimating a compute cost driver

Parse infrastructure-as-code for servers, group them by region and machine type, retrieve CPU and RAM prices from the Google Cloud Billing Catalog API, and calculate monthly cost. A policy test can multiply the estimate by server count and fail when the total exceeds a budget; adding a server produces an example failure at $4,687.62 against a $4,500 limit. section 12.1.2

Table 12.1 Your cloud bill by offering and the environment (view table figure)

Offering

Subtotal, testing environment

Subtotal, production environment

Subtotal

Compute (servers)

$400

$3,600

$4,000

Database (Cloud SQL)

$250

$2,250

$2,500

Messaging (Pub/Sub)

$100

$900

$1,000

Object storage (Cloud Storage)

$100

$900

$1,000

Data transfer (networking egress)

$100

$900

$1,000

Other (Cloud CDN, Support)

$50

$450

$500

Total

$1,000

$9,000

$10,000

Compare subtotals by offering and environment to locate the largest contributors and prioritize investigation. section 12.1

How Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform covers it

How deep it goes
Defines drivers, breaks costs down by service and environment, and connects resource attributes to policy tests and estimation.
Examples
Uses compute servers, machine types, CPU and RAM pricing, environment subtotals, resource tags, and budget-test failures.
What it assumes
Assumes familiarity with cloud resources and infrastructure as code while teaching cost decomposition and estimation workflows.
What you can do after
Diagnose major cost contributors and evaluate infrastructure changes against an expected budget.
How it connects
Connects cost drivers with infrastructure as code, cost estimation, policy tests, cloud waste, autoscaling, and cloud computing.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Infrastructure as Code, Patterns and Practices: With examples in Python and Terraform. The section links point to the parts of the book it draws on.