From d63b0ce47524943b24a0f2b6032f66269874fd52 Mon Sep 17 00:00:00 2001 From: Voicu <99695945+VoicuAWS@users.noreply.github.com> Date: Wed, 23 Oct 2024 10:39:00 -0700 Subject: [PATCH] Add RDS to Compute Optimizer Dashboard --- changes/CHANGELOG-cod.md | 3 + .../core/data/queries/co/all_options.sql | 10 +- .../core/data/queries/co/rds_database.json | 521 ++++++++++++++++++ .../data/queries/co/rds_instance_options.sql | 135 +++++ .../data/queries/co/rds_storage_options.sql | 135 +++++ cid/builtin/core/data/resources.yaml | 24 +- 6 files changed, 825 insertions(+), 3 deletions(-) create mode 100644 cid/builtin/core/data/queries/co/rds_database.json create mode 100644 cid/builtin/core/data/queries/co/rds_instance_options.sql create mode 100644 cid/builtin/core/data/queries/co/rds_storage_options.sql diff --git a/changes/CHANGELOG-cod.md b/changes/CHANGELOG-cod.md index f109839d..eb60d200 100644 --- a/changes/CHANGELOG-cod.md +++ b/changes/CHANGELOG-cod.md @@ -1,5 +1,8 @@ # What's new in the Compute Optimizer Dashboard (COD) +## Compute Optimizer Dashboard - v3.0.0 +* Added RDS Compute Optimizer sheets + ## Compute Optimizer Dashboard - v2.0.2 * Added History Visual on EBS tab diff --git a/cid/builtin/core/data/queries/co/all_options.sql b/cid/builtin/core/data/queries/co/all_options.sql index 3ec2ef3e..ffbcd7ac 100644 --- a/cid/builtin/core/data/queries/co/all_options.sql +++ b/cid/builtin/core/data/queries/co/all_options.sql @@ -1,4 +1,4 @@ -CREATE OR REPLACE VIEW compute_optimizer_all_options AS +CREATE OR REPLACE VIEW "compute_optimizer_all_options" AS ( SELECT * FROM @@ -12,4 +12,10 @@ UNION SELECT * UNION SELECT * FROM compute_optimizer_lambda_options -) \ No newline at end of file +UNION SELECT * + FROM + compute_optimizer_rds_instance_options +UNION SELECT * + FROM + compute_optimizer_rds_storage_options +) diff --git a/cid/builtin/core/data/queries/co/rds_database.json b/cid/builtin/core/data/queries/co/rds_database.json new file mode 100644 index 00000000..a1af388d --- /dev/null +++ b/cid/builtin/core/data/queries/co/rds_database.json @@ -0,0 +1,521 @@ +{ + "DatabaseName": "${athena_database_name}", + "TableInput": { + "Name": "${athenaTableName}", + "StorageDescriptor": { + "Location": "${s3FolderPath}", + "Columns": [ + { + "Name": "accountid", + "Type": "string" + }, + { + "Name": "resourcearn", + "Type": "string" + }, + { + "Name": "engine", + "Type": "string" + }, + { + "Name": "engineversion", + "Type": "string" + }, + { + "Name": "idle", + "Type": "string" + }, + { + "Name": "multiazdbinstance", + "Type": "string" + }, + { + "Name": "currentdbinstanceclass", + "Type": "string" + }, + { + "Name": "currentstorageconfigurationstoragetype", + "Type": "string" + }, + { + "Name": "currentstorageconfigurationmaxallocatedstorage", + "Type": "string" + }, + { + "Name": "currentstorageconfigurationallocatedstorage", + "Type": "string" + }, + { + "Name": "currentstorageconfigurationiops", + "Type": "string" + }, + { + "Name": "currentstorageconfigurationstoragethroughput", + "Type": "string" + }, + { + "Name": "currentstorageondemandmonthlyprice", + "Type": "string" + }, + { + "Name": "currentinstanceondemandhourlyprice", + "Type": "string" + }, + { + "Name": "lookbackperiodindays", + "Type": "string" + }, + { + "Name": "lastrefreshtimestamp", + "Type": "string" + }, + { + "Name": "utilizationmetricscpumaximum", + "Type": "string" + }, + { + "Name": "utilizationmetricsmemorymaximum", + "Type": "string" + }, + { + "Name": "utilizationmetricsebsvolumestoragespaceutilizationmaximum", + "Type": "string" + }, + { + "Name": "utilizationmetricsnetworkreceivethroughputmaximum", + "Type": "string" + }, + { + "Name": "utilizationmetricsnetworktransmitthroughputmaximum", + "Type": "string" + }, + { + "Name": "utilizationmetricsebsvolumereadiopsmaximum", + "Type": "string" + }, + { + "Name": "utilizationmetricsebsvolumewriteiopsmaximum", + "Type": "string" + }, + { + "Name": "utilizationmetricsebsvolumereadthroughputmaximum", + "Type": "string" + }, + { + "Name": "utilizationmetricsebsvolumewritethroughputmaximum", + "Type": "string" + }, + { + "Name": "utilizationmetricsdatabaseconnectionsmaximum", + "Type": "string" + }, + { + "Name": "instancefinding", + "Type": "string" + }, + { + "Name": "instancefindingreasoncodes_iscpuoverprovisioned", + "Type": "string" + }, + { + "Name": "instancefindingreasoncodes_isnetworkbandwidthoverprovisioned", + "Type": "string" + }, + { + "Name": "instancefindingreasoncodes_isebsiopsoverprovisioned", + "Type": "string" + }, + { + "Name": "instancefindingreasoncodes_isebsthroughputoverprovisioned", + "Type": "string" + }, + { + "Name": "instancefindingreasoncodes_iscpuunderprovisioned", + "Type": "string" + }, + { + "Name": "instancefindingreasoncodes_isnetworkbandwidthunderprovisioned", + "Type": "string" + }, + { + "Name": "instancefindingreasoncodes_isebsthroughputunderprovisioned", + "Type": "string" + }, + { + "Name": "instancefindingreasoncodes_isnewgenerationdbinstanceclassavailable", + "Type": "string" + }, + { + "Name": "instancefindingreasoncodes_isnewengineversionavailable", + "Type": "string" + }, + { + "Name": "storagefinding", + "Type": "string" + }, + { + "Name": "storagefindingreasoncodes_isebsvolumeallocatedstorageunderprovisioned", + "Type": "string" + }, + { + "Name": "storagefindingreasoncodes_isebsvolumethroughputunderprovisioned", + "Type": "string" + }, + { + "Name": "storagefindingreasoncodes_isebsvolumeiopsoverprovisioned", + "Type": "string" + }, + { + "Name": "storagefindingreasoncodes_isebsvolumethroughputoverprovisioned", + "Type": "string" + }, + { + "Name": "storagefindingreasoncodes_isnewgenerationstoragetypeavailable", + "Type": "string" + }, + { + "Name": "instance_recommendations_count", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_1_dbinstanceclass", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_1_rank", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_1_performancerisk", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_1_projectedutilizationmetricscpumaximum", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_1_instanceondemandhourlyprice", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_1_savingsopportunitypercentage", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_1_estimatedmonthlysavingscurrency", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_1_estimatedmonthlysavingsvalue", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_1_savingsopportunityafterdiscountspercentage", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_1_estimatedmonthlysavingscurrencyafterdiscounts", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_1_estimatedmonthlysavingsvalueafterdiscounts", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_2_dbinstanceclass", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_2_rank", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_2_performancerisk", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_2_projectedutilizationmetricscpumaximum", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_2_instanceondemandhourlyprice", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_2_savingsopportunitypercentage", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_2_estimatedmonthlysavingscurrency", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_2_estimatedmonthlysavingsvalue", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_2_savingsopportunityafterdiscountspercentage", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_2_estimatedmonthlysavingscurrencyafterdiscounts", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_2_estimatedmonthlysavingsvalueafterdiscounts", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_3_dbinstanceclass", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_3_rank", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_3_performancerisk", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_3_projectedutilizationmetricscpumaximum", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_3_instanceondemandhourlyprice", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_3_savingsopportunitypercentage", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_3_estimatedmonthlysavingscurrency", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_3_estimatedmonthlysavingsvalue", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_3_savingsopportunityafterdiscountspercentage", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_3_estimatedmonthlysavingscurrencyafterdiscounts", + "Type": "string" + }, + { + "Name": "instancerecommendationoptions_3_estimatedmonthlysavingsvalueafterdiscounts", + "Type": "string" + }, + { + "Name": "storage_recommendations_count", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_storagetype", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_allocatedstorage", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_maxallocatedstorage", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_iops", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_storagethroughput", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_rank", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_ondemandmonthlyprice", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_savingsopportunitypercentage", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_estimatedmonthlysavingscurrency", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_estimatedmonthlysavingsvalue", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_savingsopportunityafterdiscountspercentage", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_estimatedmonthlysavingscurrencyafterdiscounts", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_1_estimatedmonthlysavingsvalueafterdiscounts", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_storagetype", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_allocatedstorage", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_maxallocatedstorage", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_iops", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_storagethroughput", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_rank", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_ondemandmonthlyprice", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_savingsopportunitypercentage", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_estimatedmonthlysavingscurrency", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_estimatedmonthlysavingsvalue", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_savingsopportunityafterdiscountspercentage", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_estimatedmonthlysavingscurrencyafterdiscounts", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_2_estimatedmonthlysavingsvalueafterdiscounts", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_storagetype", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_allocatedstorage", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_maxallocatedstorage", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_iops", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_storagethroughput", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_rank", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_ondemandmonthlyprice", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_savingsopportunitypercentage", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_estimatedmonthlysavingscurrency", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_estimatedmonthlysavingsvalue", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_savingsopportunityafterdiscountspercentage", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_estimatedmonthlysavingscurrencyafterdiscounts", + "Type": "string" + }, + { + "Name": "storagerecommendationoptions_3_estimatedmonthlysavingsvalueafterdiscounts", + "Type": "string" + }, + { + "Name": "effectiverecommendationpreferencescpuvendorarchitectures", + "Type": "string" + }, + { + "Name": "effectiverecommendationpreferencesenhancedinfrastructuremetrics", + "Type": "string" + }, + { + "Name": "effectiverecommendationpreferenceslookbackperiod", + "Type": "string" + }, + { + "Name": "effectiverecommendationpreferencessavingsestimationmodesource", + "Type": "string" + }, + { + "Name": "errorcode", + "Type": "string" + }, + { + "Name": "errormessage", + "Type": "string" + }, + { + "Name": "tags", + "Type": "string" + } + ], + "InputFormat": "org.apache.hadoop.mapred.TextInputFormat", + "NumberOfBuckets": -1, + "OutputFormat": "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat", + "Parameters": {}, + "SerdeInfo": { + "Parameters": { + "quoteChar": "\"", + "separatorChar": ",", + "serialization.format": "1" + }, + "SerializationLibrary": "org.apache.hadoop.hive.serde2.OpenCSVSerde" + } + }, + "Parameters": { + "EXTERNAL": "TRUE", + "skip.header.line.count": "1" + }, + "PartitionKeys": [], + "TableType": "EXTERNAL_TABLE" + } +} \ No newline at end of file diff --git a/cid/builtin/core/data/queries/co/rds_instance_options.sql b/cid/builtin/core/data/queries/co/rds_instance_options.sql new file mode 100644 index 00000000..3c630e97 --- /dev/null +++ b/cid/builtin/core/data/queries/co/rds_instance_options.sql @@ -0,0 +1,135 @@ +CREATE OR REPLACE VIEW "compute_optimizer_rds_instance_options" AS +( + SELECT + TRY("date_parse"(lastrefreshtimestamp, '%Y-%m-%dT%H:%i:%s.%fZ')) lastrefreshtimestamp_utc + , accountid accountid + , resourcearn arn + , TRY("split_part"(resourcearn, ':', 4)) region + , TRY("split_part"(resourcearn, ':', 3)) service + , TRY("split_part"(resourcearn, ':', 7)) name + , 'rds_instance' module + , 'rds_instance' recommendationsourcetype + , instancefinding finding + , CONCAT((CASE WHEN (instancefindingreasoncodes_iscpuoverprovisioned = 'true') THEN 'CPU-Over ' ELSE '' END), (CASE WHEN (instancefindingreasoncodes_iscpuunderprovisioned = 'true') THEN 'CPU-Under ' ELSE '' END), (CASE WHEN (instancefindingreasoncodes_isebsiopsoverprovisioned = 'true') THEN 'EBSIOPS-Over ' ELSE '' END), (CASE WHEN (instancefindingreasoncodes_isebsthroughputoverprovisioned = 'true') THEN 'EBSThroughput-Over ' ELSE '' END), (CASE WHEN (instancefindingreasoncodes_isebsthroughputunderprovisioned = 'true') THEN 'EBSThroughput-Under ' ELSE '' END), (CASE WHEN (instancefindingreasoncodes_isnetworkbandwidthoverprovisioned = 'true') THEN 'NetworkBandwidth-Over ' ELSE '' END), (CASE WHEN (instancefindingreasoncodes_isnetworkbandwidthunderprovisioned = 'true') THEN 'NetworkBandwidth-Under ' ELSE '' END), (CASE WHEN (instancefindingreasoncodes_isnewgenerationdbinstanceclassavailable = 'true') THEN 'NewGenDBInstanceClass-Available ' ELSE '' END), (CASE WHEN (instancefindingreasoncodes_isnewengineversionavailable = 'true') THEN 'NewEngineVersion-Available ' ELSE '' END)) reason + , lookbackperiodindays lookbackperiodindays + , 'none' currentperformancerisk + , errorcode errorcode + , errormessage errormessage + , effectiverecommendationpreferencesenhancedinfrastructuremetrics ressouce_details + , CONCAT(utilizationmetricscpumaximum, ';', utilizationmetricsmemorymaximum, ';', utilizationmetricsnetworkreceivethroughputmaximum, ';', utilizationmetricsnetworktransmitthroughputmaximum, ';', utilizationmetricsebsvolumereadiopsmaximum, ';', utilizationmetricsebsvolumewriteiopsmaximum, ';', utilizationmetricsebsvolumereadthroughputmaximum, ';', utilizationmetricsebsvolumewritethroughputmaximum, ';', utilizationmetricsdatabaseconnectionsmaximum, ';') utilizationmetrics + , 'Current' option_name + , currentdbinstanceclass option_from + , '' option_to + , instanceRecommendationOptions_1_estimatedMonthlySavingsCurrency currency + , TRY((CAST(currentinstanceondemandhourlyprice AS double) * 730)) monthlyprice + , TRY(CAST(currentinstanceondemandhourlyprice AS double)) hourlyprice + , 0E0 estimatedmonthlysavings_value + , 0E0 estimatedmonthly_ondemand_cost_change + , GREATEST((CASE WHEN (instancerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_very_low + , GREATEST((CASE WHEN (instancerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_low + , GREATEST((CASE WHEN (instancerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_medium + , CONCAT(';', COALESCE(currentdbinstanceclass, 'na'), ';', ';', ';', ';', ';', ';', ';', COALESCE(currentinstanceondemandhourlyprice, 'na'), ';', ';', COALESCE(utilizationmetricscpumaximum, 'na'), ';') option_details + , tags tags + FROM + compute_optimizer_rds_instance_lines + WHERE (resourcearn LIKE '%arn:%') +UNION SELECT + TRY("date_parse"(lastrefreshtimestamp, '%Y-%m-%dT%H:%i:%s.%fZ')) lastrefreshtimestamp_utc + , accountid accountid + , resourcearn arn + , TRY("split_part"(resourcearn, ':', 4)) region + , TRY("split_part"(resourcearn, ':', 3)) service + , TRY("split_part"(resourcearn, ':', 7)) name + , 'rds_instance' module + , 'rds_instance' recommendationsourcetype + , instancefinding finding + , '' reason + , lookbackperiodindays lookbackperiodindays + , '' currentperformancerisk + , errorcode errorcode + , errormessage errormessage + , '' ressouce_details + , '' utilizationmetrics + , 'Option 1' option_name + , currentdbinstanceclass option_from + , instancerecommendationoptions_1_dbinstanceclass option_to + , instanceRecommendationOptions_1_estimatedMonthlySavingsCurrency currency + , TRY((CAST(instancerecommendationoptions_1_instanceondemandhourlyprice AS double) * 730)) monthlyprice + , TRY(CAST(instancerecommendationoptions_1_instanceondemandhourlyprice AS double)) hourlyprice + , TRY(CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double)) estimatedmonthlysavings_value + , TRY(((CAST(currentinstanceondemandhourlyprice AS double) * 730) - (CAST(instancerecommendationoptions_1_instanceondemandhourlyprice AS double) * 730))) estimatedmonthly_ondemand_cost_change + , GREATEST((CASE WHEN (instancerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_very_low + , GREATEST((CASE WHEN (instancerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_low + , GREATEST((CASE WHEN (instancerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_medium + , CONCAT(COALESCE(instancerecommendationoptions_1_rank, 'na'), ';', COALESCE(instancerecommendationoptions_1_dbinstanceclass, 'na'), ';', COALESCE(instancerecommendationoptions_1_estimatedmonthlysavingscurrency, 'na'), ';', COALESCE(instancerecommendationoptions_1_estimatedmonthlysavingscurrencyafterdiscounts, 'na'), ';', COALESCE(instancerecommendationoptions_1_estimatedmonthlysavingscurrency, 'na'), ';', COALESCE(instancerecommendationoptions_1_estimatedmonthlysavingsvalue, 'na'), ';', COALESCE(instancerecommendationoptions_1_savingsopportunitypercentage, 'na'), ';', COALESCE(instancerecommendationoptions_1_savingsopportunityafterdiscountspercentage, 'na'), ';', COALESCE(instancerecommendationoptions_1_instanceondemandhourlyprice, 'na'), ';', COALESCE(instancerecommendationoptions_1_performancerisk, 'na'), ';', COALESCE(instancerecommendationoptions_1_projectedutilizationmetricscpumaximum, 'na'), ';') option_details + , tags tags + FROM + compute_optimizer_rds_instance_lines + WHERE (resourcearn LIKE '%arn:%') +UNION SELECT + TRY("date_parse"(lastrefreshtimestamp, '%Y-%m-%dT%H:%i:%s.%fZ')) lastrefreshtimestamp_utc + , accountid accountid + , resourcearn arn + , TRY("split_part"(resourcearn, ':', 4)) region + , TRY("split_part"(resourcearn, ':', 3)) service + , TRY("split_part"(resourcearn, ':', 7)) name + , 'rds_instance' module + , 'rds_instance' recommendationsourcetype + , instancefinding finding + , '' reason + , lookbackperiodindays lookbackperiodindays + , '' currentperformancerisk + , errorcode errorcode + , errormessage errormessage + , '' ressouce_details + , '' utilizationmetrics + , 'Option 2' option_name + , currentdbinstanceclass option_from + , instancerecommendationoptions_2_dbinstanceclass option_to + , instanceRecommendationOptions_2_estimatedMonthlySavingsCurrency currency + , TRY((CAST(instancerecommendationoptions_2_instanceondemandhourlyprice AS double) * 730)) monthlyprice + , TRY(CAST(instancerecommendationoptions_2_instanceondemandhourlyprice AS double)) hourlyprice + , TRY(CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double)) estimatedmonthlysavings_value + , TRY(((CAST(currentinstanceondemandhourlyprice AS double) * 730) - (CAST(instancerecommendationoptions_2_instanceondemandhourlyprice AS double) * 730))) estimatedmonthly_ondemand_cost_change + , GREATEST((CASE WHEN (instancerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_very_low + , GREATEST((CASE WHEN (instancerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_low + , GREATEST((CASE WHEN (instancerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_medium + , CONCAT(COALESCE(instancerecommendationoptions_2_rank, 'na'), ';', COALESCE(instancerecommendationoptions_2_dbinstanceclass, 'na'), ';', COALESCE(instancerecommendationoptions_2_estimatedmonthlysavingscurrency, 'na'), ';', COALESCE(instancerecommendationoptions_2_estimatedmonthlysavingscurrencyafterdiscounts, 'na'), ';', COALESCE(instancerecommendationoptions_2_estimatedmonthlysavingscurrency, 'na'), ';', COALESCE(instancerecommendationoptions_2_estimatedmonthlysavingsvalue, 'na'), ';', COALESCE(instancerecommendationoptions_2_savingsopportunitypercentage, 'na'), ';', COALESCE(instancerecommendationoptions_2_savingsopportunityafterdiscountspercentage, 'na'), ';', COALESCE(instancerecommendationoptions_2_instanceondemandhourlyprice, 'na'), ';', COALESCE(instancerecommendationoptions_2_performancerisk, 'na'), ';', COALESCE(instancerecommendationoptions_2_projectedutilizationmetricscpumaximum, 'na'), ';') option_details + , tags tags + FROM + compute_optimizer_rds_instance_lines + WHERE ((resourcearn LIKE '%arn:%') AND (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '')) +UNION SELECT + TRY("date_parse"(lastrefreshtimestamp, '%Y-%m-%dT%H:%i:%s.%fZ')) lastrefreshtimestamp_utc + , accountid accountid + , resourcearn arn + , TRY("split_part"(resourcearn, ':', 4)) region + , TRY("split_part"(resourcearn, ':', 3)) service + , TRY("split_part"(resourcearn, ':', 7)) name + , 'rds_instance' module + , 'rds_instance' recommendationsourcetype + , instancefinding finding + , '' reason + , lookbackperiodindays lookbackperiodindays + , '' currentperformancerisk + , errorcode errorcode + , errormessage errormessage + , '' ressouce_details + , '' utilizationmetrics + , 'Option 3' option_name + , currentdbinstanceclass option_from + , instancerecommendationoptions_3_dbinstanceclass option_to + , instanceRecommendationOptions_3_estimatedMonthlySavingsCurrency currency + , TRY((CAST(instancerecommendationoptions_3_instanceondemandhourlyprice AS double) * 730)) monthlyprice + , TRY(CAST(instancerecommendationoptions_3_instanceondemandhourlyprice AS double)) hourlyprice + , TRY(CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double)) estimatedmonthlysavings_value + , TRY(((CAST(currentinstanceondemandhourlyprice AS double) * 730) - (CAST(instancerecommendationoptions_3_instanceondemandhourlyprice AS double) * 730))) estimatedmonthly_ondemand_cost_change + , GREATEST((CASE WHEN (instancerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_very_low + , GREATEST((CASE WHEN (instancerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_low + , GREATEST((CASE WHEN (instancerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(instancerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_medium + , CONCAT(COALESCE(instancerecommendationoptions_3_rank, 'na'), ';', COALESCE(instancerecommendationoptions_3_dbinstanceclass, 'na'), ';', COALESCE(instancerecommendationoptions_3_estimatedmonthlysavingscurrency, 'na'), ';', COALESCE(instancerecommendationoptions_3_estimatedmonthlysavingscurrencyafterdiscounts, 'na'), ';', COALESCE(instancerecommendationoptions_3_estimatedmonthlysavingscurrency, 'na'), ';', COALESCE(instancerecommendationoptions_3_estimatedmonthlysavingsvalue, 'na'), ';', COALESCE(instancerecommendationoptions_3_savingsopportunitypercentage, 'na'), ';', COALESCE(instancerecommendationoptions_3_savingsopportunityafterdiscountspercentage, 'na'), ';', COALESCE(instancerecommendationoptions_3_instanceondemandhourlyprice, 'na'), ';', COALESCE(instancerecommendationoptions_3_performancerisk, 'na'), ';', COALESCE(instancerecommendationoptions_3_projectedutilizationmetricscpumaximum, 'na'), ';') option_details + , tags tags + FROM + compute_optimizer_rds_instance_lines + WHERE ((resourcearn LIKE '%arn:%') AND (instancerecommendationoptions_3_estimatedmonthlysavingscurrency <> '')) +) \ No newline at end of file diff --git a/cid/builtin/core/data/queries/co/rds_storage_options.sql b/cid/builtin/core/data/queries/co/rds_storage_options.sql new file mode 100644 index 00000000..dc970842 --- /dev/null +++ b/cid/builtin/core/data/queries/co/rds_storage_options.sql @@ -0,0 +1,135 @@ +CREATE OR REPLACE VIEW "compute_optimizer_rds_storage_options" AS +( + SELECT + TRY("date_parse"(lastrefreshtimestamp, '%Y-%m-%dT%H:%i:%s.%fZ')) lastrefreshtimestamp_utc + , accountid accountid + , resourcearn arn + , TRY("split_part"(resourcearn, ':', 4)) region + , TRY("split_part"(resourcearn, ':', 3)) service + , TRY("split_part"(resourcearn, ':', 7)) name + , 'rds_storage' module + , 'rds_storage' recommendationsourcetype + , storagefinding finding + , CONCAT((CASE WHEN (storagefindingreasoncodes_isebsvolumeallocatedstorageunderprovisioned = 'true') THEN 'AllocatedStorage-Under ' ELSE '' END), (CASE WHEN (storagefindingreasoncodes_isebsvolumethroughputunderprovisioned = 'true') THEN 'VolumeThroughput-Under ' ELSE '' END), (CASE WHEN (storagefindingreasoncodes_isebsvolumeiopsoverprovisioned = 'true') THEN 'VolumeIOPS-Over ' ELSE '' END), (CASE WHEN (storagefindingreasoncodes_isebsvolumethroughputoverprovisioned = 'true') THEN 'VolumeThroughput-Over ' ELSE '' END), (CASE WHEN (storagefindingreasoncodes_isnewgenerationstoragetypeavailable = 'true') THEN 'NewGenStorageType-Available ' ELSE '' END)) reason + , lookbackperiodindays lookbackperiodindays + , 'none' currentperformancerisk + , errorcode errorcode + , errormessage errormessage + , effectiverecommendationpreferencesenhancedinfrastructuremetrics ressouce_details + , CONCAT(utilizationmetricsebsvolumereadiopsmaximum, ';', utilizationmetricsebsvolumewriteiopsmaximum, ';', utilizationmetricsebsvolumereadthroughputmaximum, ';', utilizationmetricsebsvolumewritethroughputmaximum, ';', utilizationmetricsebsvolumestoragespaceutilizationmaximum, ';') utilizationmetrics + , 'Current' option_name + , currentstorageconfigurationstoragetype option_from + , '' option_to + , storagerecommendationoptions_1_estimatedmonthlysavingscurrency currency + , TRY(CAST(currentstorageondemandmonthlyprice AS double)) monthlyprice + , TRY((CAST(currentstorageondemandmonthlyprice AS double) / 730)) hourlyprice + , 0E0 estimatedmonthlysavings_value + , 0E0 estimatedmonthly_ondemand_cost_change + , GREATEST((CASE WHEN (storagerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_very_low + , GREATEST((CASE WHEN (storagerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_low + , GREATEST((CASE WHEN (storagerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_medium + , CONCAT(';', COALESCE(currentstorageconfigurationstoragetype, 'na'), ';', ';', ';', ';', ';', ';', COALESCE(currentstorageconfigurationallocatedstorage, 'na'), ';', COALESCE(currentstorageconfigurationiops, 'na'), ';', COALESCE(currentstorageconfigurationstoragethroughput, 'na'), ';', COALESCE(currentstorageconfigurationmaxallocatedstorage, 'na'), ';', COALESCE(currentstorageondemandmonthlyprice, 'na'), ';', ';') option_details + , tags tags + FROM + compute_optimizer_rds_instance_lines + WHERE (resourcearn LIKE '%arn:%') +UNION SELECT + TRY("date_parse"(lastrefreshtimestamp, '%Y-%m-%dT%H:%i:%s.%fZ')) lastrefreshtimestamp_utc + , accountid accountid + , resourcearn arn + , TRY("split_part"(resourcearn, ':', 4)) region + , TRY("split_part"(resourcearn, ':', 3)) service + , TRY("split_part"(resourcearn, ':', 7)) name + , 'rds_storage' module + , 'rds_storage' recommendationsourcetype + , storagefinding finding + , '' reason + , lookbackperiodindays lookbackperiodindays + , '' currentperformancerisk + , errorcode errorcode + , errormessage errormessage + , '' ressouce_details + , '' utilizationmetrics + , 'Option 1' option_name + , currentstorageconfigurationstoragetype option_from + , storagerecommendationoptions_1_storagetype option_to + , storagerecommendationoptions_1_estimatedmonthlysavingscurrency currency + , TRY(CAST(storagerecommendationoptions_1_ondemandmonthlyprice AS double)) monthlyprice + , TRY((CAST(storagerecommendationoptions_1_ondemandmonthlyprice AS double) / 730)) hourlyprice + , TRY(CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double)) estimatedmonthlysavings_value + , TRY((CAST(currentstorageondemandmonthlyprice AS double) - CAST(storagerecommendationoptions_1_ondemandmonthlyprice AS double))) estimatedmonthly_ondemand_cost_change + , GREATEST((CASE WHEN (storagerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_very_low + , GREATEST((CASE WHEN (storagerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_low + , GREATEST((CASE WHEN (storagerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_medium + , CONCAT(COALESCE(storagerecommendationoptions_1_rank, 'na'), ';', COALESCE(storagerecommendationoptions_1_storagetype, 'na'), ';', COALESCE(storagerecommendationoptions_1_estimatedmonthlysavingscurrencyafterdiscounts, 'na'), ';', COALESCE(storagerecommendationoptions_1_estimatedmonthlysavingsvalueafterdiscounts, 'na'), ';', COALESCE(storagerecommendationoptions_1_estimatedmonthlysavingscurrency, 'na'), ';', COALESCE(storagerecommendationoptions_1_estimatedmonthlysavingsvalue, 'na'), ';', COALESCE(storagerecommendationoptions_1_savingsopportunitypercentage, 'na'), ';', COALESCE(storagerecommendationoptions_1_allocatedstorage, 'na'), ';', COALESCE(storagerecommendationoptions_1_iops, 'na'), ';', COALESCE(storagerecommendationoptions_1_storagethroughput, 'na'), ';', COALESCE(storagerecommendationoptions_1_maxallocatedstorage, 'na'), ';', COALESCE(storagerecommendationoptions_1_ondemandmonthlyprice, 'na'), ';', COALESCE(storagerecommendationoptions_1_savingsopportunityafterdiscountspercentage, 'na'), ';') option_details + , tags tags + FROM + compute_optimizer_rds_instance_lines + WHERE (resourcearn LIKE '%arn:%') +UNION SELECT + TRY("date_parse"(lastrefreshtimestamp, '%Y-%m-%dT%H:%i:%s.%fZ')) lastrefreshtimestamp_utc + , accountid accountid + , resourcearn arn + , TRY("split_part"(resourcearn, ':', 4)) region + , TRY("split_part"(resourcearn, ':', 3)) service + , TRY("split_part"(resourcearn, ':', 7)) name + , 'rds_storage' module + , 'rds_storage' recommendationsourcetype + , storagefinding finding + , '' reason + , lookbackperiodindays lookbackperiodindays + , '' currentperformancerisk + , errorcode errorcode + , errormessage errormessage + , '' ressouce_details + , '' utilizationmetrics + , 'Option 2' option_name + , currentstorageconfigurationstoragetype option_from + , storagerecommendationoptions_2_storagetype option_to + , storagerecommendationoptions_2_estimatedmonthlysavingscurrency currency + , TRY(CAST(storagerecommendationoptions_2_ondemandmonthlyprice AS double)) monthlyprice + , TRY((CAST(storagerecommendationoptions_2_ondemandmonthlyprice AS double) / 730)) hourlyprice + , TRY(CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double)) estimatedmonthlysavings_value + , TRY((CAST(currentstorageondemandmonthlyprice AS double) - CAST(storagerecommendationoptions_2_ondemandmonthlyprice AS double))) estimatedmonthly_ondemand_cost_change + , GREATEST((CASE WHEN (storagerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_very_low + , GREATEST((CASE WHEN (storagerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_low + , GREATEST((CASE WHEN (storagerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_medium + , CONCAT(COALESCE(storagerecommendationoptions_2_rank, 'na'), ';', COALESCE(storagerecommendationoptions_2_storagetype, 'na'), ';', COALESCE(storagerecommendationoptions_2_estimatedmonthlysavingscurrencyafterdiscounts, 'na'), ';', COALESCE(storagerecommendationoptions_2_estimatedmonthlysavingsvalueafterdiscounts, 'na'), ';', COALESCE(storagerecommendationoptions_2_estimatedmonthlysavingscurrency, 'na'), ';', COALESCE(storagerecommendationoptions_2_estimatedmonthlysavingsvalue, 'na'), ';', COALESCE(storagerecommendationoptions_2_savingsopportunitypercentage, 'na'), ';', COALESCE(storagerecommendationoptions_2_allocatedstorage, 'na'), ';', COALESCE(storagerecommendationoptions_2_iops, 'na'), ';', COALESCE(storagerecommendationoptions_2_storagethroughput, 'na'), ';', COALESCE(storagerecommendationoptions_2_maxallocatedstorage, 'na'), ';', COALESCE(storagerecommendationoptions_2_ondemandmonthlyprice, 'na'), ';', COALESCE(storagerecommendationoptions_2_savingsopportunityafterdiscountspercentage, 'na'), ';') option_details + , tags tags + FROM + compute_optimizer_rds_instance_lines + WHERE ((resourcearn LIKE '%arn:%') AND (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '')) +UNION SELECT + TRY("date_parse"(lastrefreshtimestamp, '%Y-%m-%dT%H:%i:%s.%fZ')) lastrefreshtimestamp_utc + , accountid accountid + , resourcearn arn + , TRY("split_part"(resourcearn, ':', 4)) region + , TRY("split_part"(resourcearn, ':', 3)) service + , TRY("split_part"(resourcearn, ':', 7)) name + , 'rds_storage' module + , 'rds_storage' recommendationsourcetype + , storagefinding finding + , '' reason + , lookbackperiodindays lookbackperiodindays + , '' currentperformancerisk + , errorcode errorcode + , errormessage errormessage + , '' ressouce_details + , '' utilizationmetrics + , 'Option 3' option_name + , currentstorageconfigurationstoragetype option_from + , storagerecommendationoptions_3_storagetype option_to + , storagerecommendationoptions_3_estimatedmonthlysavingscurrency currency + , TRY(CAST(storagerecommendationoptions_3_ondemandmonthlyprice AS double)) monthlyprice + , TRY((CAST(storagerecommendationoptions_3_ondemandmonthlyprice AS double) / 730)) hourlyprice + , TRY(CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double)) estimatedmonthlysavings_value + , TRY((CAST(currentstorageondemandmonthlyprice AS double) - CAST(storagerecommendationoptions_3_ondemandmonthlyprice AS double))) estimatedmonthly_ondemand_cost_change + , GREATEST((CASE WHEN (storagerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_very_low + , GREATEST((CASE WHEN (storagerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_low + , GREATEST((CASE WHEN (storagerecommendationoptions_1_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_1_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_2_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_2_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END), (CASE WHEN (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '') THEN TRY_CAST(storagerecommendationoptions_3_estimatedmonthlysavingsvalue AS double) ELSE 0E0 END)) max_estimatedmonthlysavings_value_medium + , CONCAT(COALESCE(storagerecommendationoptions_3_rank, 'na'), ';', COALESCE(storagerecommendationoptions_3_storagetype, 'na'), ';', COALESCE(storagerecommendationoptions_3_estimatedmonthlysavingscurrencyafterdiscounts, 'na'), ';', COALESCE(storagerecommendationoptions_3_estimatedmonthlysavingsvalueafterdiscounts, 'na'), ';', COALESCE(storagerecommendationoptions_3_estimatedmonthlysavingscurrency, 'na'), ';', COALESCE(storagerecommendationoptions_3_estimatedmonthlysavingsvalue, 'na'), ';', COALESCE(storagerecommendationoptions_3_savingsopportunitypercentage, 'na'), ';', COALESCE(storagerecommendationoptions_3_allocatedstorage, 'na'), ';', COALESCE(storagerecommendationoptions_3_iops, 'na'), ';', COALESCE(storagerecommendationoptions_3_storagethroughput, 'na'), ';', COALESCE(storagerecommendationoptions_3_maxallocatedstorage, 'na'), ';', COALESCE(storagerecommendationoptions_3_ondemandmonthlyprice, 'na'), ';', COALESCE(storagerecommendationoptions_3_savingsopportunityafterdiscountspercentage, 'na'), ';') option_details + , tags tags + FROM + compute_optimizer_rds_instance_lines + WHERE ((resourcearn LIKE '%arn:%') AND (storagerecommendationoptions_3_estimatedmonthlysavingscurrency <> '')) +) \ No newline at end of file diff --git a/cid/builtin/core/data/resources.yaml b/cid/builtin/core/data/resources.yaml index acbf89a3..5fb17a3e 100644 --- a/cid/builtin/core/data/resources.yaml +++ b/cid/builtin/core/data/resources.yaml @@ -545,6 +545,14 @@ views: default: 's3://cid-data-{account_id}/compute_optimizer/compute_optimizer_ec2_instance' description: Compute Optimiser EC2 report S3 path + compute_optimizer_rds_instance_lines: + type: Glue_Table + File: co/rds_database.json + parameters: + s3FolderPath: + default: 's3://cid-data-{account_id}/compute_optimizer/compute_optimizer_rds_database' + description: Compute Optimiser RDS report S3 path + compute_optimizer_auto_scale_lines: type: Glue_Table File: co/auto_scale.json @@ -593,6 +601,18 @@ views: views: - compute_optimizer_lambda_lines + compute_optimizer_rds_storage_options: + File: co/rds_storage_options.sql + dependsOn: + views: + - compute_optimizer_rds_instance_lines + + compute_optimizer_rds_instance_options: + File: co/rds_instance_options.sql + dependsOn: + views: + - compute_optimizer_rds_instance_lines + compute_optimizer_all_options: File: co/all_options.sql dependsOn: @@ -601,6 +621,8 @@ views: - compute_optimizer_auto_scale_options - compute_optimizer_ebs_volume_options - compute_optimizer_lambda_options + - compute_optimizer_rds_instance_options + - compute_optimizer_rds_storage_options # Shared views @@ -686,4 +708,4 @@ crawlers: parameters: s3path: default: 's3://cid-{account_id}-cur/cur/' - description: CUR path \ No newline at end of file + description: CUR path