Short Form Rules

Some Custom Group Dimensions may have fairly simple and straight forward logic which defines them. For those cases, a set of short form rules can be used that provide a simpler ways to define a Custom Group Dimension. Short form rules are useful when you have simple cases where you do not need to combine rule types (i.e. Group and GroupBy rules).

Custom Group Dimensions defined using a short form rule use the same properties as any other Custom Group Dimension definition. However, instead of a Rules section, you use one of the two short form rules: Groups and GroupBy.

Additionally, Custom Allocation Dimensions are always defined using short form rules.

Groups Short Form Rule

The Groups short form rule allows you to easily define static element names with conditions for which charges go into the elements. All conditions are supported, including conditions with source overrides.

A Groups short form rule is defined as follows:

  <DimensionId>:
    <Base Dimension Properties>
    Groups:
      <Element Name 1>:
        - <Conditions>
      <Element Name 2>:
        - <Conditions>
      <Element Name N>:
        - <Conditions>

For example, consider a case where you have a simple mapping for environments where most charges can be determined by account IDs with a few exceptions. To do this with the Group rule, the definition would be:

  Environment:
    Source: Account
    Rules:
      - Type: Group
         Name: Production
         Conditions:
           - Equals:
              - 123456789010
              - 123456789011
      - Type: Group
         Name: DevOps
         Conditions:
           - Equals:
              - 123456789012
              - 123456789013
           - Source: CZ:Defined:Category
             Equals: Cloud Management
           - Source: Service
             Contains: Support
      - Type: Group
         Name: Development
         Conditions:
           - Equals:
              - 123456789014
              - 123456789015
      - Type: Group
         Name: Test
         Conditions:
           - Equals:
              - 123456789016
              - 123456789017

Using the short from Groups rule, this can be simplified into:

  Environment:
    Source: Account
    Groups:
      Production:
         - Equals:
            - 123456789010
            - 123456789011
      DevOps:
         - Equals:
            - 123456789012
            - 123456789013
         - Source: CZ:Defined:Category
           Equals: Cloud Management
         - Source: Service
           Contains: Support
      Development:
         - Equals:
            - 123456789014
            - 123456789015
      Test:
         - Equals:
            - 123456789016
            - 123456789017

GroupBy Short Form Rule

The GroupBy short form rule is useful when you are only grouping elements by a single set of sources, with or without transforms.

The GroupBy short form rule is defined as follows:

  <DimensionId>:
    <Base Dimension Properties>
    GroupBy:
      <Source Properties>
      Format: <Format string>
      Conditions:
         - <Conditions>

The properties supported in the GroupBy section are the same as the GroupBy rule except for the Type property, which is not used in this form.

So for example, if you were going to create a dimension that divided your charges by country code, you would define it as follows:

  CountryCode:
    Name: Country Code
    DefaultValue: Global
    Rules:
      - Type: GroupBy
        Source: Region
        Transforms:
          - Type: Split
            Delimiter: '-'
            Index: 1

Using the short form rule, this would be:

  CountryCode:
    Name: Country Code
    DefaultValue: Global
    GroupBy:
      Source: Region
      Transforms:
        - Type: Split
          Delimiter: '-'
          Index: 1

AllocateByStreams Short Form Rule

This dimension can only be defined using the short form and allows splitting costs using telemetry. The syntax is as follows:

<DimensionId>:
  <Base Dimension Properties>
  Type: Allocation
  AllocateByStreams:
    Streams:
      - <Stream>

AllocateByRules Short Form Rule

This Dimension can only be defined using the short form and allows splitting costs among the elements of another dimension, either evenly or relative to their costs. The syntax is as follows:

<DimensionId>:
    <Base Dimension Properties>
    Type: Allocation
    AllocateByRules:
      AllocationMethod: Proportional *OR* Even
      SpendToAllocate:
        # This attribute defines what spend we want to split.
        # For example, the following code describes all RDS spend in the
        # account "123456789012". The cost considered for this split will be 
        # the Real Cost of the targets, and not the Billed, or Discounted costs.
        
        Conditions:
          - And:
            - Source: Account
              Equals: 123456789012
            - Source: Service
              Equals: AWS RDS

      AcrossElements:
        # This attribute defines how we want to split the spend.
        #
        # The Rules Allocation Dimension will also have an elements for every
        # element defined here ("Product A", "Product B", and "Product C").
        #
        # If AllocationMethod is Proportional, the cost of the element
        # in the Rules Allocation Dimension will equal:
        #    - the cost defined above in SpendToAllocate,
        #    - multiplied by the ratio of that element's cost vs. the sum of
        #       all elements in the inline dimension.
        #
        # In concrete terms, on any given day, the cost of "Product A" in
        # this dimension will equal:
        #   1. the cost defined in SpendToAllocate,
        #   2. multiplied by the cost of "Product A" in "SingleTenantProductDimension"
        #   3. divided by the sum of "Product A", "Product B",
        #        and "Product C" in "SingleTenantProductDimension".
        #
        # If AllocationMethod is Even, the cost of the element in the Rules
        # Allocation Dimension will equal:
        #    -  the cost defined above in SpendToAllocate,
        #    - divided by the number of distinct elements in AcrossElements
        #       (concretely, divided by 3 for "Product A", "Product B", "Product C")
        #
        # This results in a dimension where the shared cost, the RDS
        # database, is split among to the elements in
        # the "SingleTenantProductDimension" dimension.
        #
        Rules:
          - Type: GroupBy
            Source: SingleTenantProduct
            Conditions:
              - Equals:
                - Product A
                - Product B
                - Product C
      ForEachElementOf:
        # The optional ForEachElementOf attribute is designed to further segment the 
        # SpendToAllocate based on another dimension. This is especially useful when 
        # there's a need for a nuanced proportional allocation due to the presence of 
        # multiple categorizations or layers.
        Source: Environment
        Values:
          - dev
          - prod
1101
  • Inside AllocationByRules we have four keys:
    • AllocationMethod defines how the cost will be split. This can be "Proportional" (split relative to the costs in AcrossElements) or "Even".
      • Please Note: The cost considered for this split will be the Real Cost of the targets, and not the Billed, or Discounted costs.
    • SpendToAllocate defines the spend we will split. Keys supported under SpendToAllocate are: Source, Sources, CoalesceSources, and Conditions.
    • AcrossElements defines what the element names will be and, in the Proportional case, the proportions for how the cost will be split. This can be done using the short form syntax for Group or GroupBy dimensions or the longer form Rules syntax shown above. In addition, the following keys are also supported under AcrossElements: Source, Sources, Transforms.
    • ForEachElementOf (Optional) further segments or categorizes SpendToAllocate based on another dimension. This is done when there is a need for a nuanced proportional allocation due to the presence of multiple layers or categorizations. This essentially offers a streamlined way to allocate costs, segregating them according to this additional dimension without the need to create redundant filters or dimensions. For example, you can have a dimension such as Environment, with potential values of "dev" or "prod". ForEachElementOf can be written using the short form syntax for Group or GroupBy dimensions or the longer form Rules syntax shown above. The following keys are also supported under ForEachElementOf: Source, Sources, Transforms.

Here is an example using the GroupBy shorthand syntax under AcrossElements:

  RDSSplitCosts:
    Name: RDS Split Costs
    Hide: True
    Type: Allocation
    AllocateByRules:
      AllocationMethod: Proportional
      SpendToAllocate:
        Conditions:
          - And:
            - Source: Account
              Equals: 061190967865
            - Source: Service
              Equals: AWS RDS

      AcrossElements:
        GroupBy:
          Source: SingleTenantProduct
          Conditions:
            - Equals:
                - Product A
                - Product B
                - Product C

Here is an example using the Rules shorthand syntax under ForEachElementOf:

  RDSSplitCosts:
    Name: RDS Split Costs
    Hide: True
    Type: Allocation
    AllocateByRules:
      AllocationMethod: Proportional
      SpendToAllocate:
        Conditions:
          - And:
            - Source: Account
              Equals: 061190967865
            - Source: Service
              Equals: AWS RDS
      AcrossElements:
        GroupBy:
          Source: SingleTenantProduct
          Conditions:
            - Equals:
                - Product A
                - Product B
                - Product C
      ForEachElementOf:
        GroupBy:
          Source: Region

Here is an example using the Groups shorthand syntax under ProportionalTo:

  RDSSplitCosts:
    Name: RDS Split Costs
    Hide: True
    Type: Allocation
    AllocateByRules:
      AllocationMethod: Even
      SpendToAllocate:
        Conditions:
          - And:
            - Source: Account
              Equals: 061190967865
            - Source: Service
              Equals: AWS RDS

      AcrossElements:
        Source: SingleTenantProduct
        Groups:
          Product A:
            - Equals: Product A
          Product B:
            - Equals: Product B
          Product C:
            - Equals: Product C