Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[COST-5148] update EC2 compute insert sql #5206

Merged
merged 7 commits into from
Jul 9, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,30 @@ FROM (
resourcetags as tags,
costcategory,
nullif(pricing_unit, '') as unit,
sum(lineitem_usageamount) as usage_amount,
/* According to AWS docs on Savings Plans:
SavingsPlanCoveredUsage entries have corresponding SavingsPlanNegation line items
that offset that cost and usage.
For more information, refer to:
https://docs.aws.amazon.com/cur/latest/userguide/cur-sp.html
*/
maskarb marked this conversation as resolved.
Show resolved Hide resolved
sum(
CASE
WHEN lineitem_lineitemtype='SavingsPlanCoveredUsage'
THEN 0.0
ELSE lineitem_usageamount
END
) as usage_amount,
max(lineitem_normalizationfactor) as normalization_factor,
sum(lineitem_normalizedusageamount) as normalized_usage_amount,
max(lineitem_currencycode) as currency_code,
max(lineitem_unblendedrate) as unblended_rate,
sum(lineitem_unblendedcost) as unblended_cost,
sum(
CASE
WHEN lineitem_lineitemtype='SavingsPlanCoveredUsage'
THEN 0.0
ELSE lineitem_unblendedcost
END
maskarb marked this conversation as resolved.
Show resolved Hide resolved
) as unblended_cost,
max(lineitem_blendedrate) as blended_rate,
sum(lineitem_blendedcost) as blended_cost,
sum(savingsplan_savingsplaneffectivecost) as savingsplan_effective_cost,
Expand All @@ -116,7 +134,8 @@ FROM (
AND year = '{{year | sqlsafe}}'
AND month = '{{month | sqlsafe}}'
AND lineitem_productcode = 'AmazonEC2'
AND product_productfamily LIKE '%Compute%'
AND product_productfamily LIKE '%Compute Instance%'
AND lineitem_resourceid != ''
maskarb marked this conversation as resolved.
Show resolved Hide resolved
GROUP BY lineitem_resourceid,
lineitem_usageaccountid,
product_instancetype,
Expand Down
Loading