Complete Dimension Examples

This page provides three complete, end-to-end examples showing how to create each type of CloudZero Dimension. These examples walk through real-world scenarios with practical solutions you can adapt to your own use cases.

How to use these examples:

  • Step-by-step instructions are specific to the Dimension Studio Visual Editor.
  • Concepts and strategies (handling inconsistent tags, rule ordering, allocation logic) apply equally to CostFormation YAML definitions.
  • Each example includes "Why This Works" sections explaining the underlying logic.

What's covered:

  1. Environment Dimension (Group): Categorize costs by environment with inconsistent tagging.
  2. Shared RDS Allocation (Allocate By Rules): Distribute database costs proportionally across applications.
  3. API Gateway Allocation (Allocate By Streams): Usage-based allocation using telemetry data.

Example 1: Creating an Environment Dimension (Group)

Scenario: Your organization wants to track costs by environment (Production, Staging, Development), but your infrastructure uses inconsistent tagging: some resources are tagged Environment: prod, others Env: production, and some use account names like prod-account-123.

Solution: Create a Group Dimension with rules that handle all variations.

Step-by-Step Configuration

Step 1: Navigate and Create

  1. Click Dimensions+ Add New Dimension.
  2. Select Group DimensionNext.
  3. Enter Display Name: Environment.
  4. Click Create.

Step 2: Configure Parameters

  • Dimensions Name: Environment (pre-filled)
  • Default Value: Untagged
  • Child: Select Service (so users can drill from Environment → Service)
  • Hide: Off
  • Disable: Off

Step 3: Create Rules

Rule 1: Production (most specific)

Type: Group
Name: Production
Logic: And
Transforms: Lower
Conditions:
  - Source: Environment Tag
    Operator: Equals
    Values: prod, production, prd

Rule 2: Production by Account Name (catch account-based naming)

Type: Group
Name: Production
Logic: And
Conditions:
  - Source: Account Name
    Operator: Contains
    Value: prod

Rule 3: Staging

Type: Group
Name: Staging
Logic: Or
Transforms: Lower
Conditions:
  - Source: Environment Tag
    Operator: Equals
    Values: staging, stage, stg
  - Source: Account Name
    Operator: Contains
    Value: staging

Rule 4: Development

Type: Group
Name: Development
Logic: Or
Transforms: Lower
Conditions:
  - Source: Environment Tag
    Operator: Equals
    Values: dev, development, devel
  - Source: Account Name
    Operator: Contains
    Value: dev

Step 4: Publish

Click Publish Changes and confirm in the modal.

Expected Results

After publishing, your costs will be categorized as:

  • Production: All resources tagged with prod/production/prd OR in accounts with "prod" in the name.
  • Staging: Resources tagged staging/stage/stg OR in staging accounts.
  • Development: Resources tagged dev/development OR in dev accounts.
  • Untagged: Any resources that don't match the above rules.

Why This Works

  • Transforms (Lower): Handles mixed-case tags like PROD, Prod, prod.
  • Or logic: Catches resources using either tags or account naming conventions.
  • Rule order: Most specific rules first, with Default Value as fallback.
  • Child dimension: Enables easy drill-down from Environment to Service in Explorer.

Example 2: Allocating Shared RDS Costs (Allocate By Rules)

Scenario: Your organization has a shared RDS database in the shared-infrastructure account that serves three applications: Mobile, Web, and API. You want to allocate these database costs proportionally based on each application's existing share of total cloud spend.

Solution: Create an Allocate By Rules Dimension with proportional allocation.

Step-by-Step Configuration

Step 1: Navigate and Create

  1. Click Dimensions+ Add New Dimension.
  2. Select Allocation DimensionNext.
  3. Enter Display Name: Shared RDS Allocation.
  4. Select Allocate By Rules.
  5. Click Create.

Step 2: Configure Parameters

  • Dimensions Name: Shared RDS Allocation (pre-filled)
  • Default Value: Unallocated
  • Hide: Off
  • Disable: Off

Step 3: Configure Allocation Method

Select Proportional (costs split based on each element's proportion of total cloud spend).

Step 4: Define Spend To Allocate

Identify the shared RDS costs:

Logic: And
Conditions:
  - Source: Service Category
    Operator: Equals
    Value: Database
  - Source: Account Name
    Operator: Equals
    Value: shared-infrastructure
  - Source: Resource Tag (optional - for specific RDS instance)
    Operator: Contains
    Value: shared-rds

Step 5: Define Across Elements

Create three elements representing each application:

Rule 1: Mobile App

Type: Group
Name: Mobile - Shared RDS
Conditions:
  - Source: Application Tag
    Operator: Equals
    Value: mobile

Rule 2: Web App

Type: Group
Name: Web - Shared RDS
Conditions:
  - Source: Application Tag
    Operator: Equals
    Value: web

Rule 3: API

Type: Group
Name: API - Shared RDS
Conditions:
  - Source: Application Tag
    Operator: Equals
    Value: api

How proportional allocation works: CloudZero will calculate each application's proportion of total cloud spend, then allocate the shared RDS costs using those same proportions. For example, if Mobile represents 50% of your total cloud spend, it will receive 50% of the shared RDS costs.

Step 6: Publish

Click Publish Changes and confirm in the modal.

Expected Results

CloudZero will automatically calculate allocation based on each application's share of total cloud spend.

Example: If your shared RDS costs $10,000/month and your total cloud spend breakdown is:

  • Mobile: $50,000 (50% of total)
  • Web: $30,000 (30% of total)
  • API: $20,000 (20% of total)

Then the RDS allocation will be:

  • Mobile - Shared RDS: $5,000 (50%)
  • Web - Shared RDS: $3,000 (30%)
  • API - Shared RDS: $2,000 (20%)

Why This Works

  • Spend To Allocate: Precisely identifies only the shared RDS database costs using multiple conditions.
  • Proportional method: Automatically mirrors each application's proportion of total cloud spend—no manual percentages needed.
  • Dynamic allocation: As application spend changes over time, the RDS allocation automatically adjusts to match.
  • Named categories: Clear allocation targets that appear in reports.

Alternative Approach: Even Split

If you want to split costs evenly across all three applications instead:

  1. Change Allocation Method to Even.
  2. Result: Each application gets $3,333.33 (⅓ of $10,000).

Example 3: Allocating Costs by Telemetry (Allocate By Streams)

Scenario: Your organization has a shared API gateway that serves multiple teams. You send telemetry data to CloudZero showing API call volume per team. You want to allocate API gateway costs based on actual usage (if Team A makes 60% of API calls, they should receive 60% of costs).

Prerequisites:

  • Telemetry stream already configured: api-calls-by-team
  • Stream data includes dimensions: team_name, api_call_count

Solution: Create an Allocate By Streams Dimension that uses your telemetry data.

Step-by-Step Configuration

Step 1: Navigate and Create

  1. Click Dimensions+ Add New Dimension.
  2. Select Allocation DimensionNext.
  3. Enter Display Name: API Gateway Allocation by Usage.
  4. Select Allocate By Streams (default).
  5. Click Create.

Step 2: Configure Parameters

  • Dimensions Name: API Gateway Allocation by Usage (pre-filled)
  • Default Value: No-Telemetry-Data
  • Hide: Off
  • Disable: Off

Step 3: Select Telemetry Streams

In the Allocate By Streams section:

  1. Click the Streams field.
  2. Search for and select api-calls-by-team.
  3. Optionally add additional streams if you want to allocate by multiple usage metrics.

Step 4: Publish

Click Publish Changes and confirm in the modal.

Expected Results

CloudZero will automatically:

  1. Look at your API gateway costs for each day.
  2. Check the api-calls-by-team telemetry stream for that day.
  3. Calculate each team's percentage of total API calls.
  4. Allocate costs proportionally.

Example calculation for one day:

  • API Gateway costs: $1,000
  • Team A API calls: 6,000 (60% of total)
  • Team B API calls: 3,000 (30% of total)
  • Team C API calls: 1,000 (10% of total)

Allocated costs:

  • Team A: $600 (60%)
  • Team B: $300 (30%)
  • Team C: $100 (10%)

If a team makes no API calls on a given day, they receive $0 allocation for that day.

Why This Works

  • Dynamic allocation: Costs automatically adjust as usage patterns change.
  • Fair distribution: Teams pay based on actual usage, not estimates.
  • No manual updates: As teams scale up or down, allocation adjusts automatically.
  • Telemetry-driven: Uses real usage data from your systems.

Common Variations

Variation 1: Multiple metrics

Allocate by both API calls AND data transfer:

Streams:
  - api-calls-by-team
  - data-transfer-by-team

CloudZero will combine both metrics to determine allocation percentages.

Variation 2: Nested allocation

First allocate by team, then by environment within each team:

Streams: api-calls-by-team-by-environment

With telemetry structured to include both dimensions.