Tutorial: Apply contract rules
This tutorial provides a step-by-step analysis for distributor/reseller users to understand the Application order of billing rules, price books, and custom line items during the data recalculation of an end customer.
Contracts setup
Tier-1 contract
The Tier-1 contract defines a billing rule that excludes the following cost types: DistributorDiscount, EdpDiscount, Tax, SppDiscount.

Tier-2 contract
In this tutorial there is no Tier-2 contract, meaning no specific pricing and service agreements for the reseller.
Tier-3 contract
A Tier-3 contract is created for an end customer called Demo Customer. This contract defines one price book and two custom line items for all management accounts of the end customer.
- Price book
- Custom line item: Service Fee
- Custom line item: VAT
The price book defines four rules:
-
Rule 1: 7% discount. Does not include credits in the calculation. Condition: Service is
Amazon Elastic Compute Cloud. Stored as a separate line item. -
Rule 2: 3% discount. Does not include credits in the calculation. Condition: Service is
Amazon Relational Database Service. -
Rule 3: Fixed rate, $0.01. Condition: SKU Meter is
TimedStorage-SIA-ByteHrsAND Service isAmazon Simple Storage Service. -
Rule 4: Fixed rate, $0.01. Condition: SKU Meter is
CAN1-TimedStorage-SIA-ByteHrsAND Service isAmazon Simple Storage Service.

This custom line item defines a fixed-rate Service Fee charge of $100. It is stored as a separate line item (Service Fee for Platform usage) and charged monthly during the entire contract period.

This custom line item defines a 17% charge of VAT and includes credits in the calculation. It is stored as a separate line item (VAT) and charged monthly during the entire contract period.

Recalculation process
Step 1: Apply Tier-1 billing rules
This step is visible only to Distributor users.
In the report below:
-
Billed Cost: The raw payer data.
-
Resold Cost: The amount the distributor charges the reseller, after applying the billing rule to exclude the cost types
DistributorDiscount,EdpDiscount,Tax, andSppDiscount.
Resold Cost starts at Billed Cost. Each excluded row’s amount is subtracted from the running total. Credits appear as negative amounts in the report, so excluding a credit subtracts a negative value and increases Resold Cost.
In this example: $98,171.26 − (-$8,098.17) − $11,297.74 = $94,971.70

Step 2: Apply Tier-3 price book
Each rule is applied based on the result of the previous rule.
Rule 1: EC2 7% discount
Because Rule 1 doesn't include credits, the EC2 Credit row is excluded from the discount base.

Applying the 7% discount: $52,962.04 × 7% = $3,707.34. The result is stored as a separate line item.

Running total: $94,971.70 − $3,707.34 = $91,264.36.
Rule 2: RDS 3% discount
Because Rule 2 doesn't include credits, the RDS Credit row is excluded from the discount base.

Applying the 3% discount: $9,699.10 × 3% = $290.97

Running total: $91,264.36 − $290.97 = $90,973.39.
Rule 3: TimedStorage-SIA-ByteHrs PPA
The fixed-rate rule sets the rate to $0.01/GB-Mo, replacing the implied list unit price of $0.0125/GB-Mo.
-
Cost before applying Rule 3:
Usage×$0.0125=$72.36 -
Cost after applying Rule 3:
Usage×$0.01=$57.89

Running total: $90,973.39 − $72.36 + $57.89 = $90,958.92
Rule 4: CAN1-TimedStorage-SIA-ByteHrs PPA
The fixed-rate rule sets the rate to $0.01/GB-Mo, replacing the implied list unit price of $0.0138/GB-Mo.
-
Cost before applying Rule 4:
Usage×$0.0138=$550.07 -
Cost after applying Rule 4:
Usage×$0.01=$398.60

Running total: $90,958.92 − $550.07 + $398.60 = $90,807.45.
Step 3: Apply Tier-3 custom line items
Custom line items run sequentially, in the order configured.
CLI 1: Service Fee
Applies a flat $100 fixed-rate charge and is stored as a separate line item Service Fee for Platform usage.
Running total: $90,807.45 + $100 = $90,907.45.
CLI 2: VAT 17%
This line item includes credits in calculation, but not Marketplace purchase, so the base is the running total minus Marketplace spend.

VAT: ($90,907.45 − $2,646.32) × 17% = $15,004.39, stored as the separate line item VAT.

Final invoice total
| Step | Change | Running total |
|---|---|---|
| List price (raw payer) | - | $98,171.26 |
| T1 BR (cost-type filter) | -$3,199.56 | $94,971.70 |
| PB · EC2 7% (separate line) | -$3,707.34 | $91,264.36 |
| PB · RDS 3% (in-line) | -$290.97 | $90,973.39 |
| PB · TimedStorage-SIA $0.01 | -$14.47 | $90,958.92 |
| PB · CAN1-TimedStorage-SIA $0.01 | -$151.47 | $90,807.45 |
| CLI · Service Fee | +$100.00 | $90,907.45 |
| CLI · VAT 17% | +$15,004.39 | $105,911.84 |