Flex report to match the below filter criteria in AWS Cost Explorer.
For EC For RDS
You can use the below Flex report query to match the above details from AWS cost explorer.
{
"sqlStatement": "SELECT SUM(lineItem_UnblendedCost) AS SUM_lineItem_UnblendedCost, SUM(reservation_EffectiveCost) AS SUM_reservation_EffectiveCost, SUM(lineItem_TotalAmortizedCost) AS SUM_lineItem_TotalAmortizedCost, SUM(savingsPlan_SavingsPlanEffectiveCost) AS SUM_savingsPlan_SavingsPlanEffectiveCost, timeInterval_Month AS Month, (SUM(lineItem_UnblendedCost) + coalesce(SUM(reservation_EffectiveCost), 0) + coalesce(SUM(savingsPlan_SavingsPlanEffectiveCost), 0) + coalesce(SUM(reservation_UnusedAmortizedUpfrontFeeForBillingPeriod), 0)) AS Total, lineItem_ProductCode AS LineItem_ProductCode, SUM(reservation_NetEffectiveCost) AS SUM_reservation_NetEffectiveCost, SUM(reservation_UnusedAmortizedUpfrontFeeForBillingPeriod) AS SUM_reservation_UnusedAmortizedUpfrontFeeForBillingPeriod FROM AWS_CUR WHERE (lineItem_LineItemType NOT IN ('Fee')) AND ((lineItem_ProductCode IN ('AmazonRDS')) OR (lineItem_ProductCode IN ('AmazonEC2'))) GROUP BY timeInterval_Month, lineItem_ProductCode, lineItem_ProductCode ORDER BY LineItem_ProductCode ASC",
"needBackLinkingForTags": true,
"dataGranularity": "MONTHLY",
"timeRange": {
"from": "2025-01",
"to": "2025-06"
},
"limit": -1
}