Here is a CUR (Cost and Usage Report) request you can use in Amazon Athena to get how much you are saving thanks to the RDS RI Exchange program.
Step 1: Verify EDP Discount Calculation for a Specific Day
This request is displaying the EDP discount for RDS for a specific day (March 18, 2023). Don’t hesitate to check it matches within Cost Explorer.
SELECT
SUM(CAST(discount_edp_discount AS DOUBLE)) AS total_edp_discount
FROM
[REPLACE_WITH_ATHENA_TABLE_NAME]
WHERE
product_product_name LIKE '%Amazon Relational Database Service%'
AND line_item_usage_start_date >= CAST('2023-03-18' AS timestamp)
AND line_item_usage_start_date < CAST('2023-03-19' AS timestamp)
Step 2: Calculate RI-Only Discount
Now you just have to apply the desired rate.
Let’s say the previous EDP rate for RDS was 2% and the new one is 5% (hypothetical values for the sake of the example).
The Athena request on the CUR would be:
SELECT
-- the 0.6 is (5-2)/5
SUM(CAST(discount_edp_discount AS DOUBLE)) * 0.6 AS total_edp_discount_ri_only
FROM
[REPLACE_WITH_ATHENA_TABLE_NAME]
WHERE
product_product_name LIKE '%Amazon Relational Database Service%'
AND line_item_usage_start_date >= CAST('2023-03-18' AS timestamp)
AND line_item_usage_start_date < CAST('2023-03-19' AS timestamp)
Now it is your turn, use your own value and your own date range to understand how much exactly you are saving thanks to the RDS RI Exchange.