Combining Dedicated and Shared Cost

It is common for cost of a SaaS product to include some dedicated resources, used exclusively by the product, and some shared resources, used by many products. In the previous example, Split Shared Costs Using Telemetry, we saw how to split the cost of shared resources proportionally among different products. In this example we'll build on that and make a new dimension that combines the shared and dedicated cost.

Splitting Shared Cost

Here is the CostFormation YAML from the previous telemetry examples. It creates two dimensions, one to isolate the cost of a "Shared Data Lake" and a second to split that cost using telemetry into two elements: Email and Messaging. (Note, the element names are specified by the telemetry records, not shown here.)

Dimensions:
  SharedRDS:
    Name: Shared RDS
    DefaultValue: Not Shared
    Rules:
      - Type: Group
        Name: Shared Data Lake
        Conditions:
          - Source: Service
            Equals: AmazonRDS
  SplitDataLake:
    Type: Allocation
    Name: Split Data Lake
    AllocateByStreams:
      Streams:
        - rds-writes-by-product

Creating a Product Dimension

...
  Product:
    Name: Product
    DefaultValue: Other
    Rules:
      - Type: Group
        Name: Email
        Conditions:
          - Source: Tag:Product
            Equals: email
      - Type: Group
        Name: Messaging
        Conditions:
          - Source: Tag:Product
            Equals: messaging
      - Type: GroupBy
        Source: User:Defined:SplitDataLake

Group Rules

First we create a Group rule for each product type. In this example we only have two: Email and Messaging. Each rule uses Conditions to specify the resources used exclusively by that product. In this simple case these resources are identified simply by an AWS tag -- in a real world case this would most likely be more complex.

GroupBy Rule

The final rule is a GroupBy used to add in the shared cost from the SplitDataLake dimension we created earlier. Since that dimension uses the same element names (Email and Messaging) the result combines the shared and dedicated cost.

πŸ“˜

The approach is the same for creating a "Product" dimension where the split is done with a Proportional Allocation dimension. The main difference is that the Source of the GroupBy rule would be adjusted to reference the Proportional Allocation Dimension.