From 8b8deac43b1895766eb321c68870c0dcdf99d6bb Mon Sep 17 00:00:00 2001 From: Eric Christensen Date: Tue, 26 Sep 2023 20:01:56 +0000 Subject: [PATCH 1/2] KPI savings estimations additions --- .../data/queries/kpi/kpi_ebs_storage_view.sql | 39 +++++++++++++- .../queries/kpi/kpi_instance_all_view.sql | 53 ++++++++++++++++++- .../kpi/kpi_instance_all_view_noRI.sql | 51 +++++++++++++++++- .../kpi/kpi_instance_all_view_noRISP.sql | 51 +++++++++++++++++- .../kpi/kpi_instance_all_view_noSP.sql | 51 +++++++++++++++++- .../data/queries/kpi/kpi_s3_storage_view.sql | 8 +++ .../queries/kpi/last_kpi_tracker_view.sql | 45 ++++++++++++++++ 7 files changed, 293 insertions(+), 5 deletions(-) diff --git a/cid/builtin/core/data/queries/kpi/kpi_ebs_storage_view.sql b/cid/builtin/core/data/queries/kpi/kpi_ebs_storage_view.sql index bd761f91..c158a8d7 100644 --- a/cid/builtin/core/data/queries/kpi/kpi_ebs_storage_view.sql +++ b/cid/builtin/core/data/queries/kpi/kpi_ebs_storage_view.sql @@ -75,6 +75,18 @@ ebs_spend_with_unit_cost AS ( WHEN usage_storage_gb_mo <= 150 THEN 0 ELSE 125 END AS gp2_usage_added_throughput_gibps_mo + -->>SAVINGS: look at inverse from a current gp3 perspective + , CASE WHEN volume_api_name <> 'gp3' THEN 0 + WHEN usage_storage_gb_mo*3 < 3000 THEN 3000 - 3000 + WHEN usage_storage_gb_mo*3 > 16000 THEN 16000 - 3000 + ELSE usage_storage_gb_mo*3 - 3000 + END equiv_gp2_usage_added_iops_mo + , CASE + WHEN volume_api_name <> 'gp3' THEN 0 + WHEN usage_storage_gb_mo <= 150 THEN 0 + ELSE 125 + END equiv_gp2_usage_added_throughput_gibps_mo + --<>SAVINGS: look at inverse from a current gp3 perspective + , CASE + WHEN volume_api_name = 'gp3' THEN (cost_storage_gb_mo/8E-1) / usage_storage_gb_mo + ELSE 0 + END "estimated_gp2_unit_cost" + --<>SAVINGS: look at inverse from a current gp3 perspective + , sum(equiv_gp2_usage_added_iops_mo) equiv_gp2_usage_added_iops_mo + , sum(equiv_gp2_usage_added_throughput_gibps_mo) equiv_gp2_usage_added_throughput_gibps_mo + --<>SAVINGS: look at inverse from a current gp3 perspective + , sum(CASE + WHEN (volume_api_name = 'gp3') THEN + ( + ( + (cost_storage_gb_mo/8E-1) + + ((estimated_gp2_unit_cost*5E-1) * equiv_gp2_usage_added_throughput_gibps_mo) + ) + + ((estimated_gp2_unit_cost*6E-2) * equiv_gp2_usage_added_iops_mo) + ) ELSE 0 + END) ebs_gp2_potential_cost + --<>SAVINGS: look at inverse from a current gp3 perspective + , ebs_gp2_potential_cost - ebs_gp3_cost gp3_current_savings + --< 'Graviton')) THEN amortized_cost*.2 ELSE 0 END "lambda_graviton_potential_savings" /*Uses 20% savings estimate*/ - + +/*Savings estimation*/ + -->>SAVINGS: + -- EC2 Graviton current savings + , CASE + WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 8E-1) + ELSE 0 END "ec2_graviton_current_savings" + -- EC2 AMD current savings + , CASE + WHEN (adjusted_processor = 'AMD') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 9E-1) + ELSE 0 END "ec2_amd_current_savings" + -- Spot current savings + , CASE WHEN ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonEC2') AND + ("instance_type" <> '') AND + ("operation" LIKE '%RunInstances%') AND + (purchase_option = 'Spot') AND (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (adjusted_amortized_cost / 5.5E-1) + ELSE 0 END "ec2_spot_current_savings" + -- Latest generation current savings + , CASE WHEN ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonEC2') AND + ("instance_type" <> '') AND + ("operation" LIKE '%RunInstances%') AND + (generation IN ('Current')) AND + (purchase_option <> 'Spot') AND + (purchase_option <> 'Reserved') AND + (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (amortized_cost / 9.5E-1) + ELSE 0 END "ec2_latest_generation_current_savings" + -- RDS Graviton current savings + , CASE WHEN (adjusted_processor = 'Graviton') AND + ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonRDS') AND + (purchase_option = 'OnDemand') AND + (database_engine IN ('Aurora MySQL', 'Aurora PostgreSQL', 'MariaDB', 'PostgreSQL')) THEN (amortized_cost / 9E-1) + ELSE 0 END "rds_graviton_current_savings" + -- ElastiCache Graviton current savings + , CASE WHEN (adjusted_processor = 'Graviton') AND + ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonElastiCache') THEN (amortized_cost / .95) + ELSE 0 END "elasticache_graviton_current_savings" + -- AOS Graviton current saving + , CASE WHEN ("charge_type" = 'Usage') AND + ("product_code" = 'AmazonES') AND + (adjusted_processor = 'Graviton') THEN (amortized_cost / .95) + ELSE 0 END "opensearch_graviton_current_savings" + -- Lambda Graviton current saving + , CASE WHEN ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AWSLambda') AND + (adjusted_processor = 'Graviton') THEN (amortized_cost / 8E-1) + ELSE 0 END "lambda_graviton_current_savings" + --< 'Graviton')) THEN amortized_cost*.2 ELSE 0 END "lambda_graviton_potential_savings" /*Uses 20% savings estimate*/ - +/*Savings estimation*/ + -->>SAVINGS: + -- EC2 Graviton current savings + , CASE + WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 8E-1) + ELSE 0 END "ec2_graviton_current_savings" + -- EC2 AMD current savings + , CASE + WHEN (adjusted_processor = 'AMD') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 9E-1) + ELSE 0 END "ec2_amd_current_savings" + -- Spot current savings + , CASE WHEN ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonEC2') AND + ("instance_type" <> '') AND + ("operation" LIKE '%RunInstances%') AND + (purchase_option = 'Spot') AND (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (adjusted_amortized_cost / 5.5E-1) + ELSE 0 END "ec2_spot_current_savings" + -- Latest generation current savings + , CASE WHEN ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonEC2') AND + ("instance_type" <> '') AND + ("operation" LIKE '%RunInstances%') AND + (generation IN ('Current')) AND + (purchase_option <> 'Spot') AND + (purchase_option <> 'Reserved') AND + (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (amortized_cost / 9.5E-1) + ELSE 0 END "ec2_latest_generation_current_savings" + -- RDS Graviton current savings + , CASE WHEN (adjusted_processor = 'Graviton') AND + ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonRDS') AND + (purchase_option = 'OnDemand') AND + (database_engine IN ('Aurora MySQL', 'Aurora PostgreSQL', 'MariaDB', 'PostgreSQL')) THEN (amortized_cost / 9E-1) + ELSE 0 END "rds_graviton_current_savings" + -- ElastiCache Graviton current savings + , CASE WHEN (adjusted_processor = 'Graviton') AND + ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonElastiCache') THEN (amortized_cost / .95) + ELSE 0 END "elasticache_graviton_current_savings" + -- AOS Graviton current saving + , CASE WHEN ("charge_type" = 'Usage') AND + ("product_code" = 'AmazonES') AND + (adjusted_processor = 'Graviton') THEN (amortized_cost / .95) + ELSE 0 END "opensearch_graviton_current_savings" + -- Lambda Graviton current saving + , CASE WHEN ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AWSLambda') AND + (adjusted_processor = 'Graviton') THEN (amortized_cost / 8E-1) + ELSE 0 END "lambda_graviton_current_savings" + --< 'Graviton')) THEN amortized_cost*.2 ELSE 0 END "lambda_graviton_potential_savings" /*Uses 20% savings estimate*/ - +/*Savings estimation*/ + -->>SAVINGS: + -- EC2 Graviton current savings + , CASE + WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 8E-1) + ELSE 0 END "ec2_graviton_current_savings" + -- EC2 AMD current savings + , CASE + WHEN (adjusted_processor = 'AMD') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 9E-1) + ELSE 0 END "ec2_amd_current_savings" + -- Spot current savings + , CASE WHEN ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonEC2') AND + ("instance_type" <> '') AND + ("operation" LIKE '%RunInstances%') AND + (purchase_option = 'Spot') AND (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (adjusted_amortized_cost / 5.5E-1) + ELSE 0 END "ec2_spot_current_savings" + -- Latest generation current savings + , CASE WHEN ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonEC2') AND + ("instance_type" <> '') AND + ("operation" LIKE '%RunInstances%') AND + (generation IN ('Current')) AND + (purchase_option <> 'Spot') AND + (purchase_option <> 'Reserved') AND + (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (amortized_cost / 9.5E-1) + ELSE 0 END "ec2_latest_generation_current_savings" + -- RDS Graviton current savings + , CASE WHEN (adjusted_processor = 'Graviton') AND + ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonRDS') AND + (purchase_option = 'OnDemand') AND + (database_engine IN ('Aurora MySQL', 'Aurora PostgreSQL', 'MariaDB', 'PostgreSQL')) THEN (amortized_cost / 9E-1) + ELSE 0 END "rds_graviton_current_savings" + -- ElastiCache Graviton current savings + , CASE WHEN (adjusted_processor = 'Graviton') AND + ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonElastiCache') THEN (amortized_cost / .95) + ELSE 0 END "elasticache_graviton_current_savings" + -- AOS Graviton current saving + , CASE WHEN ("charge_type" = 'Usage') AND + ("product_code" = 'AmazonES') AND + (adjusted_processor = 'Graviton') THEN (amortized_cost / .95) + ELSE 0 END "opensearch_graviton_current_savings" + -- Lambda Graviton current saving + , CASE WHEN ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AWSLambda') AND + (adjusted_processor = 'Graviton') THEN (amortized_cost / 8E-1) + ELSE 0 END "lambda_graviton_current_savings" + --< 'Graviton')) THEN amortized_cost*.2 ELSE 0 END "lambda_graviton_potential_savings" /*Uses 20% savings estimate*/ - +/*Savings estimation*/ + -->>SAVINGS: + -- EC2 Graviton current savings + , CASE + WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 8E-1) + ELSE 0 END "ec2_graviton_current_savings" + -- EC2 AMD current savings + , CASE + WHEN (adjusted_processor = 'AMD') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 9E-1) + ELSE 0 END "ec2_amd_current_savings" + -- Spot current savings + , CASE WHEN ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonEC2') AND + ("instance_type" <> '') AND + ("operation" LIKE '%RunInstances%') AND + (purchase_option = 'Spot') AND (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (adjusted_amortized_cost / 5.5E-1) + ELSE 0 END "ec2_spot_current_savings" + -- Latest generation current savings + , CASE WHEN ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonEC2') AND + ("instance_type" <> '') AND + ("operation" LIKE '%RunInstances%') AND + (generation IN ('Current')) AND + (purchase_option <> 'Spot') AND + (purchase_option <> 'Reserved') AND + (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (amortized_cost / 9.5E-1) + ELSE 0 END "ec2_latest_generation_current_savings" + -- RDS Graviton current savings + , CASE WHEN (adjusted_processor = 'Graviton') AND + ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonRDS') AND + (purchase_option = 'OnDemand') AND + (database_engine IN ('Aurora MySQL', 'Aurora PostgreSQL', 'MariaDB', 'PostgreSQL')) THEN (amortized_cost / 9E-1) + ELSE 0 END "rds_graviton_current_savings" + -- ElastiCache Graviton current savings + , CASE WHEN (adjusted_processor = 'Graviton') AND + ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AmazonElastiCache') THEN (amortized_cost / .95) + ELSE 0 END "elasticache_graviton_current_savings" + -- AOS Graviton current saving + , CASE WHEN ("charge_type" = 'Usage') AND + ("product_code" = 'AmazonES') AND + (adjusted_processor = 'Graviton') THEN (amortized_cost / .95) + ELSE 0 END "opensearch_graviton_current_savings" + -- Lambda Graviton current saving + , CASE WHEN ("charge_type" LIKE '%Usage%') AND + ("product_code" = 'AWSLambda') AND + (adjusted_processor = 'Graviton') THEN (amortized_cost / 8E-1) + ELSE 0 END "lambda_graviton_current_savings" + --< 0 THEN 'in use' ELSE 'not in use' END AS s3_analytics_in_use , CASE WHEN "s3_intelligent-tiering_storage_usage_quantity" > 0 THEN 'in use' ELSE 'not in use' END AS s3_int_in_use , s3_standard_storage_cost * s3_standard_savings AS s3_standard_storage_potential_savings + -->>SAVINGS: estimate for non-standard, currently lumped into one group from IT to Glacier, based on the current KPI method for potential + , ("s3_standard-ia_storage_cost" + + "s3_onezone-ia_storage_cost" + + "s3_intelligent-tiering_storage_cost" + + s3_glacier_instant_retrieval_storage_cost + + s3_glacier_flexible_retrieval_storage_cost + + s3_glacier_deep_archive_storage_storage_cost) / (1 - s3_standard_savings) s3_storage_current_savings + --<>SAVINGS: added fields for new chart +, coalesce(ebs_all.gp3_current_savings, 0) gp3_current_savings +, coalesce(s3_all.s3_storage_current_savings, 0) s3_storage_current_savings +, coalesce(instance_all.ec2_graviton_current_savings, 0) ec2_graviton_current_savings +, coalesce(instance_all.ec2_amd_current_savings, 0) ec2_amd_current_savings +, coalesce(instance_all.ec2_spot_current_savings, 0) ec2_spot_current_savings +, coalesce(instance_all.ec2_latest_generation_current_savings, 0) ec2_latest_generation_current_savings +, coalesce(instance_all.rds_graviton_current_savings, 0) rds_graviton_current_savings +, coalesce(instance_all.elasticache_graviton_current_savings, 0) elasticache_graviton_current_savings +, coalesce(instance_all.opensearch_graviton_current_savings, 0) opensearch_graviton_current_savings +, coalesce(instance_all.lambda_graviton_current_savings, 0) lambda_graviton_current_savings +, (coalesce(ebs_all.gp3_current_savings, 0) ++ coalesce(s3_all.s3_storage_current_savings, 0) ++ coalesce(instance_all.ec2_graviton_current_savings, 0) ++ coalesce(instance_all.ec2_amd_current_savings, 0) ++ coalesce(instance_all.ec2_spot_current_savings, 0) ++ coalesce(instance_all.ec2_latest_generation_current_savings, 0) ++ coalesce(instance_all.rds_graviton_current_savings, 0) ++ coalesce(instance_all.elasticache_graviton_current_savings, 0) ++ coalesce(instance_all.opensearch_graviton_current_savings, 0) ++ coalesce(instance_all.lambda_graviton_current_savings, 0) ++ coalesce(instance_all.rds_commit_savings, 0) ++ coalesce(instance_all.elasticache_commit_savings, 0) ++ coalesce(instance_all.compute_commit_savings, 0) ++ coalesce(instance_all.opensearch_commit_savings, 0) ++ coalesce(instance_all.redshift_commit_savings, 0) ++ coalesce(instance_all.dynamodb_commit_savings, 0) ++ coalesce(instance_all.sagemaker_commit_savings, 0)) total_current_savings +--<>SAVINGS: instance rollup + , "sum"("ec2_graviton_current_savings") "ec2_graviton_current_savings" + , "sum"("ec2_amd_current_savings") "ec2_amd_current_savings" + , "sum"("ec2_spot_current_savings") "ec2_spot_current_savings" + , "sum"("ec2_latest_generation_current_savings") "ec2_latest_generation_current_savings" + , "sum"("rds_graviton_current_savings") "rds_graviton_current_savings" + , "sum"("elasticache_graviton_current_savings") "elasticache_graviton_current_savings" + , "sum"("opensearch_graviton_current_savings") "opensearch_graviton_current_savings" + , "sum"("lambda_graviton_current_savings") "lambda_graviton_current_savings" +--<>SAVINGS: ebs rollup + , "sum"("gp3_current_savings") "gp3_current_savings" +--<>SAVINGS: s3 rollup + , "sum"("s3_storage_current_savings") "s3_storage_current_savings" +--< Date: Tue, 26 Sep 2023 22:30:24 +0000 Subject: [PATCH 2/2] Mods to ensure reporting on savings vs. estimated equiv cost -- main instance sqls --- .../data/queries/kpi/kpi_ebs_storage_view.sql | 10 ++++------ .../data/queries/kpi/kpi_instance_all_view.sql | 16 ++++++++-------- .../queries/kpi/kpi_instance_all_view_noRI.sql | 17 +++++++++-------- .../kpi/kpi_instance_all_view_noRISP.sql | 17 +++++++++-------- .../queries/kpi/kpi_instance_all_view_noSP.sql | 17 +++++++++-------- .../data/queries/kpi/kpi_s3_storage_view.sql | 4 ++-- 6 files changed, 41 insertions(+), 40 deletions(-) diff --git a/cid/builtin/core/data/queries/kpi/kpi_ebs_storage_view.sql b/cid/builtin/core/data/queries/kpi/kpi_ebs_storage_view.sql index c158a8d7..f2e9b7e4 100644 --- a/cid/builtin/core/data/queries/kpi/kpi_ebs_storage_view.sql +++ b/cid/builtin/core/data/queries/kpi/kpi_ebs_storage_view.sql @@ -122,7 +122,7 @@ ebs_spend_with_unit_cost AS ( END AS "estimated_gp3_unit_cost" -->>SAVINGS: look at inverse from a current gp3 perspective , CASE - WHEN volume_api_name = 'gp3' THEN (cost_storage_gb_mo/8E-1) / usage_storage_gb_mo + WHEN volume_api_name = 'gp3' THEN (cost_storage_gb_mo/0.8) / usage_storage_gb_mo ELSE 0 END "estimated_gp2_unit_cost" --<>SAVINGS: -- EC2 Graviton current savings , CASE - WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 8E-1) + WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 8E-1) * 2E-1 ELSE 0 END "ec2_graviton_current_savings" -- EC2 AMD current savings , CASE - WHEN (adjusted_processor = 'AMD') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 9E-1) + WHEN (adjusted_processor = 'AMD') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 9E-1) * 1E-1 ELSE 0 END "ec2_amd_current_savings" -- Spot current savings , CASE WHEN ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') AND ("instance_type" <> '') AND ("operation" LIKE '%RunInstances%') AND - (purchase_option = 'Spot') AND (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (adjusted_amortized_cost / 5.5E-1) + (purchase_option = 'Spot') AND (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (adjusted_amortized_cost / 5.5E-1) * 4.5E-1 ELSE 0 END "ec2_spot_current_savings" -- Latest generation current savings , CASE WHEN ("charge_type" LIKE '%Usage%') AND @@ -292,29 +292,29 @@ (generation IN ('Current')) AND (purchase_option <> 'Spot') AND (purchase_option <> 'Reserved') AND - (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (amortized_cost / 9.5E-1) + (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (amortized_cost / 9.5E-1) * 5E-2 ELSE 0 END "ec2_latest_generation_current_savings" -- RDS Graviton current savings , CASE WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonRDS') AND (purchase_option = 'OnDemand') AND - (database_engine IN ('Aurora MySQL', 'Aurora PostgreSQL', 'MariaDB', 'PostgreSQL')) THEN (amortized_cost / 9E-1) + (database_engine IN ('Aurora MySQL', 'Aurora PostgreSQL', 'MariaDB', 'PostgreSQL')) THEN (amortized_cost / 9E-1) * 1E-1 ELSE 0 END "rds_graviton_current_savings" -- ElastiCache Graviton current savings , CASE WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND - ("product_code" = 'AmazonElastiCache') THEN (amortized_cost / .95) + ("product_code" = 'AmazonElastiCache') THEN (amortized_cost / 9.5E-1) * 5E-2 ELSE 0 END "elasticache_graviton_current_savings" -- AOS Graviton current saving , CASE WHEN ("charge_type" = 'Usage') AND ("product_code" = 'AmazonES') AND - (adjusted_processor = 'Graviton') THEN (amortized_cost / .95) + (adjusted_processor = 'Graviton') THEN (amortized_cost / 9.5E-1) * 5E-2 ELSE 0 END "opensearch_graviton_current_savings" -- Lambda Graviton current saving , CASE WHEN ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AWSLambda') AND - (adjusted_processor = 'Graviton') THEN (amortized_cost / 8E-1) + (adjusted_processor = 'Graviton') THEN (amortized_cost / 8E-1) 2E-1 ELSE 0 END "lambda_graviton_current_savings" --<>SAVINGS: -- EC2 Graviton current savings , CASE - WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 8E-1) + WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 8E-1) * 2E-1 ELSE 0 END "ec2_graviton_current_savings" -- EC2 AMD current savings , CASE - WHEN (adjusted_processor = 'AMD') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 9E-1) + WHEN (adjusted_processor = 'AMD') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 9E-1) * 1E-1 ELSE 0 END "ec2_amd_current_savings" -- Spot current savings , CASE WHEN ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') AND ("instance_type" <> '') AND ("operation" LIKE '%RunInstances%') AND - (purchase_option = 'Spot') AND (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (adjusted_amortized_cost / 5.5E-1) + (purchase_option = 'Spot') AND (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (adjusted_amortized_cost / 5.5E-1) * 4.5E-1 ELSE 0 END "ec2_spot_current_savings" -- Latest generation current savings , CASE WHEN ("charge_type" LIKE '%Usage%') AND @@ -286,31 +286,32 @@ (generation IN ('Current')) AND (purchase_option <> 'Spot') AND (purchase_option <> 'Reserved') AND - (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (amortized_cost / 9.5E-1) + (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (amortized_cost / 9.5E-1) * 5E-2 ELSE 0 END "ec2_latest_generation_current_savings" -- RDS Graviton current savings , CASE WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonRDS') AND (purchase_option = 'OnDemand') AND - (database_engine IN ('Aurora MySQL', 'Aurora PostgreSQL', 'MariaDB', 'PostgreSQL')) THEN (amortized_cost / 9E-1) + (database_engine IN ('Aurora MySQL', 'Aurora PostgreSQL', 'MariaDB', 'PostgreSQL')) THEN (amortized_cost / 9E-1) * 1E-1 ELSE 0 END "rds_graviton_current_savings" -- ElastiCache Graviton current savings , CASE WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND - ("product_code" = 'AmazonElastiCache') THEN (amortized_cost / .95) + ("product_code" = 'AmazonElastiCache') THEN (amortized_cost / 9.5E-1) * 5E-2 ELSE 0 END "elasticache_graviton_current_savings" -- AOS Graviton current saving , CASE WHEN ("charge_type" = 'Usage') AND ("product_code" = 'AmazonES') AND - (adjusted_processor = 'Graviton') THEN (amortized_cost / .95) + (adjusted_processor = 'Graviton') THEN (amortized_cost / 9.5E-1) * 5E-2 ELSE 0 END "opensearch_graviton_current_savings" -- Lambda Graviton current saving , CASE WHEN ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AWSLambda') AND - (adjusted_processor = 'Graviton') THEN (amortized_cost / 8E-1) + (adjusted_processor = 'Graviton') THEN (amortized_cost / 8E-1) 2E-1 ELSE 0 END "lambda_graviton_current_savings" --<>SAVINGS: -- EC2 Graviton current savings , CASE - WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 8E-1) + WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 8E-1) * 2E-1 ELSE 0 END "ec2_graviton_current_savings" -- EC2 AMD current savings , CASE - WHEN (adjusted_processor = 'AMD') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 9E-1) + WHEN (adjusted_processor = 'AMD') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 9E-1) * 1E-1 ELSE 0 END "ec2_amd_current_savings" -- Spot current savings , CASE WHEN ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') AND ("instance_type" <> '') AND ("operation" LIKE '%RunInstances%') AND - (purchase_option = 'Spot') AND (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (adjusted_amortized_cost / 5.5E-1) + (purchase_option = 'Spot') AND (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (adjusted_amortized_cost / 5.5E-1) * 4.5E-1 ELSE 0 END "ec2_spot_current_savings" -- Latest generation current savings , CASE WHEN ("charge_type" LIKE '%Usage%') AND @@ -279,31 +279,32 @@ (generation IN ('Current')) AND (purchase_option <> 'Spot') AND (purchase_option <> 'Reserved') AND - (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (amortized_cost / 9.5E-1) + (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (amortized_cost / 9.5E-1) * 5E-2 ELSE 0 END "ec2_latest_generation_current_savings" -- RDS Graviton current savings , CASE WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonRDS') AND (purchase_option = 'OnDemand') AND - (database_engine IN ('Aurora MySQL', 'Aurora PostgreSQL', 'MariaDB', 'PostgreSQL')) THEN (amortized_cost / 9E-1) + (database_engine IN ('Aurora MySQL', 'Aurora PostgreSQL', 'MariaDB', 'PostgreSQL')) THEN (amortized_cost / 9E-1) * 1E-1 ELSE 0 END "rds_graviton_current_savings" -- ElastiCache Graviton current savings , CASE WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND - ("product_code" = 'AmazonElastiCache') THEN (amortized_cost / .95) + ("product_code" = 'AmazonElastiCache') THEN (amortized_cost / 9.5E-1) * 5E-2 ELSE 0 END "elasticache_graviton_current_savings" -- AOS Graviton current saving , CASE WHEN ("charge_type" = 'Usage') AND ("product_code" = 'AmazonES') AND - (adjusted_processor = 'Graviton') THEN (amortized_cost / .95) + (adjusted_processor = 'Graviton') THEN (amortized_cost / 9.5E-1) * 5E-2 ELSE 0 END "opensearch_graviton_current_savings" -- Lambda Graviton current saving , CASE WHEN ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AWSLambda') AND - (adjusted_processor = 'Graviton') THEN (amortized_cost / 8E-1) + (adjusted_processor = 'Graviton') THEN (amortized_cost / 8E-1) 2E-1 ELSE 0 END "lambda_graviton_current_savings" --<>SAVINGS: -- EC2 Graviton current savings , CASE - WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 8E-1) + WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 8E-1) * 2E-1 ELSE 0 END "ec2_graviton_current_savings" -- EC2 AMD current savings , CASE - WHEN (adjusted_processor = 'AMD') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 9E-1) + WHEN (adjusted_processor = 'AMD') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') THEN (amortized_cost / 9E-1) * 1E-1 ELSE 0 END "ec2_amd_current_savings" -- Spot current savings , CASE WHEN ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonEC2') AND ("instance_type" <> '') AND ("operation" LIKE '%RunInstances%') AND - (purchase_option = 'Spot') AND (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (adjusted_amortized_cost / 5.5E-1) + (purchase_option = 'Spot') AND (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (adjusted_amortized_cost / 5.5E-1) * 4.5E-1 ELSE 0 END "ec2_spot_current_savings" -- Latest generation current savings , CASE WHEN ("charge_type" LIKE '%Usage%') AND @@ -282,31 +282,32 @@ (generation IN ('Current')) AND (purchase_option <> 'Spot') AND (purchase_option <> 'Reserved') AND - (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (amortized_cost / 9.5E-1) + (NOT (savings_plan_offering_type LIKE '%EC2%')) THEN (amortized_cost / 9.5E-1) * 5E-2 ELSE 0 END "ec2_latest_generation_current_savings" -- RDS Graviton current savings , CASE WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AmazonRDS') AND (purchase_option = 'OnDemand') AND - (database_engine IN ('Aurora MySQL', 'Aurora PostgreSQL', 'MariaDB', 'PostgreSQL')) THEN (amortized_cost / 9E-1) + (database_engine IN ('Aurora MySQL', 'Aurora PostgreSQL', 'MariaDB', 'PostgreSQL')) THEN (amortized_cost / 9E-1) * 1E-1 ELSE 0 END "rds_graviton_current_savings" -- ElastiCache Graviton current savings , CASE WHEN (adjusted_processor = 'Graviton') AND ("charge_type" LIKE '%Usage%') AND - ("product_code" = 'AmazonElastiCache') THEN (amortized_cost / .95) + ("product_code" = 'AmazonElastiCache') THEN (amortized_cost / 9.5E-1) * 5E-2 ELSE 0 END "elasticache_graviton_current_savings" -- AOS Graviton current saving , CASE WHEN ("charge_type" = 'Usage') AND ("product_code" = 'AmazonES') AND - (adjusted_processor = 'Graviton') THEN (amortized_cost / .95) + (adjusted_processor = 'Graviton') THEN (amortized_cost / 9.5E-1) * 5E-2 ELSE 0 END "opensearch_graviton_current_savings" -- Lambda Graviton current saving , CASE WHEN ("charge_type" LIKE '%Usage%') AND ("product_code" = 'AWSLambda') AND - (adjusted_processor = 'Graviton') THEN (amortized_cost / 8E-1) + (adjusted_processor = 'Graviton') THEN (amortized_cost / 8E-1) 2E-1 ELSE 0 END "lambda_graviton_current_savings" --< 0 THEN 'in use' ELSE 'not in use' END AS s3_int_in_use , s3_standard_storage_cost * s3_standard_savings AS s3_standard_storage_potential_savings -->>SAVINGS: estimate for non-standard, currently lumped into one group from IT to Glacier, based on the current KPI method for potential - , ("s3_standard-ia_storage_cost" + + , (("s3_standard-ia_storage_cost" + "s3_onezone-ia_storage_cost" + "s3_intelligent-tiering_storage_cost" + s3_glacier_instant_retrieval_storage_cost + s3_glacier_flexible_retrieval_storage_cost + - s3_glacier_deep_archive_storage_storage_cost) / (1 - s3_standard_savings) s3_storage_current_savings + s3_glacier_deep_archive_storage_storage_cost) / (1 - s3_standard_savings)) * s3_standard_savings s3_storage_current_savings --<