Skip to content

Commit

Permalink
Merge branch 'main' into china-friendly
Browse files Browse the repository at this point in the history
  • Loading branch information
iakov-aws committed May 16, 2024
2 parents 4cb9715 + 6b7eae2 commit a74b0e0
Show file tree
Hide file tree
Showing 21 changed files with 623 additions and 375 deletions.
31 changes: 20 additions & 11 deletions cfn-templates/cur-aggregation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Metadata:
- DestinationAccountId
- ResourcePrefix
- CreateCUR
- AddSCAD
-
Label:
default: "Parameters needed in Destination (Data Collection) Account only"
Expand All @@ -22,6 +23,8 @@ Metadata:
default: "Prefix used for all named resources, including S3 Bucket. Must be the same in destination and source stacks"
SourceAccountIds:
default: "Source Account Ids (Comma separated list)"
AddSCAD:
default: "Add Split Cost Allocation Data (SCAD) to CUR."


Parameters:
Expand All @@ -41,10 +44,13 @@ Parameters:
CreateCUR:
Type: String
Description: Whether to create a local CUR in the destination account or not. Set this to False only if the current account is covered in the CUR of its Management (Payer) Account.
AllowedValues:
- "True"
- "False"
AllowedValues: ["True", "False"]
Default: "True"
AddSCAD:
Type: String
Description: Add Split Cost Allocation Data (SCAD) to CUR
AllowedValues: ['yes', 'no']
Default: "no"

##
# Destination specific params
Expand All @@ -55,19 +61,19 @@ Parameters:
AllowedPattern: "^((\\d{12})\\,?)*$"
Default: ''
Description: "A comma separated list of all Source accounts that will replicate CUR Data. Ex: 12345678912,98745612312,...."

PermissionsBoundary:
Type: String
Default: ''
Description: Define Permission Boundary for Roles if required by SCP

Conditions:
IsDestinationAccount: !Equals [!Ref DestinationAccountId, !Ref AWS::AccountId]
NeedSCAD: !Equals [!Ref AddSCAD, 'yes']
IsDestinationAccount: !Equals [!Ref DestinationAccountId, !Ref 'AWS::AccountId']
IsSourceAccount: !Not [!Condition IsDestinationAccount]
RegionSupportsCURviaCFN: # CFN supports CUR only in us-east-1 and cn-northwest-1. Other regions must use lambda
Fn::Or:
- !Equals [!Ref AWS::Region, 'us-east-1']
- !Equals [!Ref AWS::Region, 'cn-northwest-1']
- !Equals [!Ref 'AWS::Region', 'us-east-1']
- !Equals [!Ref 'AWS::Region', 'cn-northwest-1']
CUREnable: !Equals [!Ref CreateCUR, 'True']
DeployCURViaCFNInSource: !And [!Condition CUREnable, !Condition IsSourceAccount, !Condition RegionSupportsCURviaCFN]
DeployCURViaCFNInDestination: !And [!Condition CUREnable, !Condition IsDestinationAccount, !Condition RegionSupportsCURviaCFN]
Expand Down Expand Up @@ -345,7 +351,7 @@ Resources:
- "s3.amazonaws.com"
Action:
- "sts:AssumeRole"
PermissionsBoundary: !If [NeedPermissionsBoundary, !Ref PermissionsBoundary, !Ref AWS::NoValue]
PermissionsBoundary: !If [NeedPermissionsBoundary, !Ref PermissionsBoundary, !Ref "AWS::NoValue"]
Policies:
- PolicyName: CrossRegionPolicy
PolicyDocument:
Expand Down Expand Up @@ -374,7 +380,7 @@ Resources:
# Local CUR
####

## Deploy CUR natively via CFN resource if we are in us-east-1
## Deploy CUR natively via CFN resource if we are in a region that supports it
LocalCurInSource:
Type: AWS::CUR::ReportDefinition
Condition: DeployCURViaCFNInSource
Expand All @@ -385,6 +391,7 @@ Resources:
- ATHENA
AdditionalSchemaElements:
- RESOURCES
- !If [ NeedSCAD, SPLIT_COST_ALLOCATION_DATA, !Ref "AWS::NoValue"]
Compression: Parquet
Format: Parquet
RefreshClosedReports: True
Expand All @@ -405,6 +412,7 @@ Resources:
- ATHENA
AdditionalSchemaElements:
- RESOURCES
- !If [ NeedSCAD, SPLIT_COST_ALLOCATION_DATA, !Ref "AWS::NoValue"]
Compression: Parquet
Format: Parquet
RefreshClosedReports: True
Expand All @@ -429,6 +437,7 @@ Resources:
- ATHENA
AdditionalSchemaElements:
- RESOURCES
- !If [ NeedSCAD, SPLIT_COST_ALLOCATION_DATA, !Ref "AWS::NoValue"]
Compression: Parquet
Format: Parquet
RefreshClosedReports: True
Expand Down Expand Up @@ -458,7 +467,7 @@ Resources:
- lambda.amazonaws.com
Action:
- sts:AssumeRole
PermissionsBoundary: !If [NeedPermissionsBoundary, !Ref PermissionsBoundary, !Ref AWS::NoValue]
PermissionsBoundary: !If [NeedPermissionsBoundary, !Ref PermissionsBoundary, !Ref "AWS::NoValue"]
Policies:
- PolicyName: "ExecutionDefault"
PolicyDocument:
Expand Down Expand Up @@ -601,7 +610,7 @@ Resources:
- lambda.amazonaws.com
Action:
- sts:AssumeRole
PermissionsBoundary: !If [NeedPermissionsBoundary, !Ref PermissionsBoundary, !Ref AWS::NoValue]
PermissionsBoundary: !If [NeedPermissionsBoundary, !Ref PermissionsBoundary, !Ref "AWS::NoValue"]
Policies:
- PolicyName: "ExecutionDefault"
PolicyDocument:
Expand Down
26 changes: 24 additions & 2 deletions changes/CHANGELOG-extended-support-cost-projection.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
# What's new in Extended Support Cost Projection

## Extended Support Dashboard - v1.1.0
## Extended Support Cost Projection - v1.2.0

**Important:** Update to this version requires a forced and recursive update. If you have modified the Extended Support Cost Projection dashboard view queries, they will be overridden when the dashboard is updated. Consider backing-up the existing view queries if they contain custom changes you want to keep so you can re-apply them after the update takes place.

To update run these commands in your CloudShell (recommended) or other terminal:

```
python3 -m ensurepip --upgrade
pip3 install --upgrade cid-cmd
cid-cmd update --dashboard-id extended-support-cost-projection --force --recursive
```

You will be presented with the option "proceed and override" to update the RDS and EKS views. Please choose this option to ensure changes to the underlying view queries are applied in your RDS and EKS Extended support views.

- Adding preprocessing for RDS engine versions to simplify release calendar maintenance. Major versions will be used normally except in cases where minor versions are targeted for the extended support.
- Added remaining dates for the release calendar.
- Simplified release calendar maintenance by using only major version (or major.minor for where a minor version is targeted).
- Added account names and IDs to breakdown tables.
- Added start date for RDS Extended Support Estimated Cost Breakdown visual
- Increased size of EKS Extended Support Estimated Cost Breakdown to shows more items without scrolling
- Added action filters for all visuals in the dashboard

## v1.1.0
* Includes EKS Extended Support Cost Projection sheet.
* Adjusted titles for visuals showing estimated costs. Estimates are based on resource usage over a given period of time.
* Adjusted names for calculated fields and parameters.


## Extended Support Dashboard - v1.0.0
## v1.0.0
* Initial release
* Includes RDS Extended Support Cost Projection and About sheets.
5 changes: 4 additions & 1 deletion cid/builtin/core/data/queries/cid/summary_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,8 @@
WHEN ("line_item_line_item_type" <> 'SavingsPlanNegation') THEN "pricing_public_on_demand_cost" ELSE 0 END) "public_cost"
FROM
"${cur_table_name}"
WHERE (("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH)))
WHERE
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,33,34
6 changes: 4 additions & 2 deletions cid/builtin/core/data/queries/cid/summary_view_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
WHEN ("line_item_line_item_type" <> 'SavingsPlanNegation') THEN "pricing_public_on_demand_cost" ELSE 0 END) "public_cost"
FROM
"${cur_table_name}"
WHERE (("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH)))

WHERE
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,33,34
6 changes: 4 additions & 2 deletions cid/builtin/core/data/queries/cid/summary_view_sp.sql
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@
WHEN ("line_item_line_item_type" <> 'SavingsPlanNegation') THEN "pricing_public_on_demand_cost" ELSE 0 END) "public_cost"
FROM
"${cur_table_name}"
WHERE (("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH)))

WHERE
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,33,34
6 changes: 4 additions & 2 deletions cid/builtin/core/data/queries/cid/summary_view_sp_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
WHEN ("line_item_line_item_type" <> 'SavingsPlanNegation') THEN "pricing_public_on_demand_cost" ELSE 0 END) "public_cost"
FROM
"${cur_table_name}"
WHERE (("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH)))

WHERE
(("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '7' MONTH))
AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '7' MONTH))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/hourly_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ CREATE OR REPLACE VIEW hourly_view AS
, "sum"("line_item_usage_amount") "usage_quantity"
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage')))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage'))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/hourly_view_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ CREATE OR REPLACE VIEW hourly_view AS
, "sum"("line_item_usage_amount") "usage_quantity"
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage')))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage'))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/hourly_view_sp.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ CREATE OR REPLACE VIEW hourly_view AS
, "sum"("line_item_usage_amount") "usage_quantity"
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage')))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage'))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/hourly_view_sp_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ CREATE OR REPLACE VIEW hourly_view AS
, "sum"("line_item_usage_amount") "usage_quantity"
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage')))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND ((("line_item_line_item_type" = 'Usage') OR ("line_item_line_item_type" = 'SavingsPlanCoveredUsage')) OR ("line_item_line_item_type" = 'DiscountedUsage'))
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/resource_view.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ CREATE OR REPLACE VIEW resource_view AS
, "sum"("line_item_unblended_cost") unblended_cost
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND (line_item_resource_id <> ''))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND (line_item_resource_id <> '')
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/resource_view_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ CREATE OR REPLACE VIEW resource_view AS
, "sum"("line_item_unblended_cost") unblended_cost
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND (line_item_resource_id <> ''))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND (line_item_resource_id <> '')
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/resource_view_sp.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ CREATE OR REPLACE VIEW resource_view AS
, "sum"("line_item_unblended_cost") unblended_cost
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND (line_item_resource_id <> ''))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND (line_item_resource_id <> '')
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
7 changes: 5 additions & 2 deletions cid/builtin/core/data/queries/cudos/resource_view_sp_ri.sql
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@ CREATE OR REPLACE VIEW resource_view AS
, "sum"("line_item_unblended_cost") unblended_cost
FROM
"${cur_table_name}"
WHERE (((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date) AND (line_item_resource_id <> ''))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
WHERE
(((current_date - INTERVAL '30' DAY) <= line_item_usage_start_date)
AND (line_item_resource_id <> '')
AND "line_item_operation" NOT IN ('EKSPod-EC2','ECSTask-EC2'))
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29
Loading

0 comments on commit a74b0e0

Please sign in to comment.