diff --git a/dashboards/aws-marketplace/aws-marketplace-spg.yaml b/dashboards/aws-marketplace/aws-marketplace-spg.yaml index 938b8e1d..2ecafbcb 100644 --- a/dashboards/aws-marketplace/aws-marketplace-spg.yaml +++ b/dashboards/aws-marketplace/aws-marketplace-spg.yaml @@ -2,8 +2,7 @@ dashboards: AWS MARKETPLACE SINGLE PANE OF GLASS (SPG): dependsOn: datasets: - - customer_all - - marketplace_summary_view + - marketplace_view name: AWS Marketplace Single Pane of Glass (SPG) dashboardId: aws-marketplace category: Custom @@ -11,12 +10,12 @@ dashboards: sourceAccountId: '569662215076' region: us-east-1 datasets: - marketplace_summary_view: + marketplace_view: data: - DataSetId: 733729ca-6b13-4abc-b075-091db3c5b97c - Name: marketplace_summary_view + DataSetId: 4892730f-81b6-4ae5-9d45-8a32c974cd2b + Name: marketplace_view PhysicalTableMap: - 303b2d08-fcff-4ebc-96d1-f39bd30d55b8: + 208c509d-f59c-44d2-96d2-3e146f100734: RelationalTable: DataSourceArn: ${athena_datasource_arn} Catalog: AwsDataCatalog @@ -27,12 +26,12 @@ datasets: Type: STRING - Name: account_name Type: STRING - 90e899f8-a44f-478a-8f04-5a20a149a2c8: + a2826a94-1e6d-4bd1-8cac-5e35c9124af0: RelationalTable: DataSourceArn: ${athena_datasource_arn} Catalog: AwsDataCatalog Schema: ${athena_database_name} - Name: marketplace_summary_view + Name: marketplace_view InputColumns: - Name: year Type: STRING @@ -52,8 +51,6 @@ datasets: Type: STRING - Name: charge_category Type: STRING - - Name: purchase_option - Type: STRING - Name: product_code Type: STRING - Name: product_name @@ -66,8 +63,6 @@ datasets: Type: DATETIME - Name: subscription_end_date Type: DATETIME - - Name: operation - Type: STRING - Name: item_description Type: STRING - Name: availability_zone @@ -80,162 +75,73 @@ datasets: Type: STRING - Name: pricing_unit Type: STRING - - Name: resource_id_count - Type: INTEGER - Name: usage_quantity Type: DECIMAL - Name: unblended_cost Type: DECIMAL - - Name: amortized_cost - Type: DECIMAL + LogicalTableMap: - 24c5f031-8560-4547-abf1-19c159a033a4: + 097d3f27-562a-4d8f-bcee-bad5d5e0bc7d: + Alias: marketplace_view + Source: + PhysicalTableId: a2826a94-1e6d-4bd1-8cac-5e35c9124af0 + 566d0885-92f6-4005-9db6-6968263e13fa: Alias: Intermediate Table DataTransforms: - TagColumnOperation: - ColumnName: Region + ColumnName: region Tags: - ColumnGeographicRole: STATE - ProjectOperation: ProjectedColumns: - - Year - - Month - - Billing Period - - Usage Date - - Payer Account - - Linked Account - - Invoice Id - - Charge Type - - Charge Category - - Purchase Option - - Product Code - - Product Name - - Service - - Usage Type - - Subscription Start Date - - Subscription End Date - - Operation - - Item Description - - Availability Zone - - Region - - Legal Entity - - Billing Entity - - Pricing Unit - - Resource Id Count - - Usage Quantity - - Unblended Cost - - Amortized Cost + - year + - month + - billing_period + - usage_date + - payer_account_id + - linked_account_id + - invoice_id + - charge_type + - charge_category + - product_code + - product_name + - service + - usage_type + - subscription_start_date + - subscription_end_date + - item_description + - availability_zone + - region + - legal_entity + - billing_entity + - pricing_unit + - usage_quantity + - unblended_cost - account_id - account_name Source: JoinInstruction: - LeftOperand: 694b2b97-904c-44d9-8b2b-aac8ef433fc4 - RightOperand: 48ca2fb5-54dc-44f5-9cb8-d680f53afe37 + LeftOperand: 097d3f27-562a-4d8f-bcee-bad5d5e0bc7d + RightOperand: ac72cd4f-6a48-4f09-9bbc-4dbe873a764c Type: LEFT - OnClause: '{Linked Account} = {account_id}' - 48ca2fb5-54dc-44f5-9cb8-d680f53afe37: + OnClause: '{linked_account_id} = {account_id}' + ac72cd4f-6a48-4f09-9bbc-4dbe873a764c: Alias: account_map Source: - PhysicalTableId: 303b2d08-fcff-4ebc-96d1-f39bd30d55b8 - 694b2b97-904c-44d9-8b2b-aac8ef433fc4: - Alias: marketplace_summary_view - DataTransforms: - - RenameColumnOperation: - ColumnName: year - NewColumnName: Year - - RenameColumnOperation: - ColumnName: month - NewColumnName: Month - - RenameColumnOperation: - ColumnName: billing_period - NewColumnName: Billing Period - - RenameColumnOperation: - ColumnName: usage_date - NewColumnName: Usage Date - - RenameColumnOperation: - ColumnName: payer_account_id - NewColumnName: Payer Account - - RenameColumnOperation: - ColumnName: linked_account_id - NewColumnName: Linked Account - - RenameColumnOperation: - ColumnName: invoice_id - NewColumnName: Invoice Id - - RenameColumnOperation: - ColumnName: charge_type - NewColumnName: Charge Type - - RenameColumnOperation: - ColumnName: charge_category - NewColumnName: Charge Category - - RenameColumnOperation: - ColumnName: purchase_option - NewColumnName: Purchase Option - - RenameColumnOperation: - ColumnName: product_code - NewColumnName: Product Code - - RenameColumnOperation: - ColumnName: product_name - NewColumnName: Product Name - - RenameColumnOperation: - ColumnName: service - NewColumnName: Service - - RenameColumnOperation: - ColumnName: usage_type - NewColumnName: Usage Type - - RenameColumnOperation: - ColumnName: subscription_start_date - NewColumnName: Subscription Start Date - - RenameColumnOperation: - ColumnName: subscription_end_date - NewColumnName: Subscription End Date - - RenameColumnOperation: - ColumnName: operation - NewColumnName: Operation - - RenameColumnOperation: - ColumnName: item_description - NewColumnName: Item Description - - RenameColumnOperation: - ColumnName: availability_zone - NewColumnName: Availability Zone - - RenameColumnOperation: - ColumnName: region - NewColumnName: Region - - RenameColumnOperation: - ColumnName: legal_entity - NewColumnName: Legal Entity - - RenameColumnOperation: - ColumnName: billing_entity - NewColumnName: Billing Entity - - RenameColumnOperation: - ColumnName: pricing_unit - NewColumnName: Pricing Unit - - RenameColumnOperation: - ColumnName: resource_id_count - NewColumnName: Resource Id Count - - RenameColumnOperation: - ColumnName: usage_quantity - NewColumnName: Usage Quantity - - RenameColumnOperation: - ColumnName: unblended_cost - NewColumnName: Unblended Cost - - RenameColumnOperation: - ColumnName: amortized_cost - NewColumnName: Amortized Cost - Source: - PhysicalTableId: 90e899f8-a44f-478a-8f04-5a20a149a2c8 + PhysicalTableId: 208c509d-f59c-44d2-96d2-3e146f100734 ImportMode: SPICE dependsOn: views: - account_map - - marketplace_summary_view + - marketplace_view schedules: - default views: - marketplace_summary_view: + marketplace_view: dependsOn: cur: true data: |- - CREATE OR REPLACE VIEW ${athena_database_name}.marketplace_summary_view AS + CREATE OR REPLACE VIEW ${athena_database_name}.marketplace_view AS SELECT "year" "year" , "month" "month" @@ -246,25 +152,21 @@ views: , "bill_invoice_id" "invoice_id" , "line_item_line_item_type" "charge_type" , (CASE WHEN ("line_item_line_item_type" = 'DiscountedUsage') THEN 'Running_Usage' WHEN ("line_item_line_item_type" = 'SavingsPlanCoveredUsage') THEN 'Running_Usage' WHEN ("line_item_line_item_type" = 'Usage') THEN 'Running_Usage' ELSE 'non_usage' END) "charge_category" - , (CASE WHEN ("savings_plan_savings_plan_a_r_n" <> '') THEN 'SavingsPlan' WHEN ("reservation_reservation_a_r_n" <> '') THEN 'Reserved' WHEN ("line_item_usage_type" LIKE '%Spot%') THEN 'Spot' ELSE 'OnDemand' END) "purchase_option" , "line_item_product_code" "product_code" , "product_product_name" "product_name" , (CASE WHEN (("bill_billing_entity" = 'AWS Marketplace') AND (NOT ("line_item_line_item_type" LIKE '%Discount%'))) THEN "Product_Product_Name" WHEN ("product_servicecode" = '') THEN "line_item_product_code" ELSE "product_servicecode" END) "service" , "line_item_usage_type" "usage_type" , CAST(from_iso8601_timestamp(split_part(identity_time_interval, '/', 1)) AS timestamp) "subscription_start_date" , CAST(from_iso8601_timestamp(split_part(identity_time_interval, '/', 2)) AS timestamp) "subscription_end_date" - , "line_item_operation" "operation" , "line_item_line_item_description" "item_description" , "line_item_availability_zone" "availability_zone" , "product_region" "region" , "line_item_legal_entity" "legal_entity" , "bill_billing_entity" "billing_entity" , "pricing_unit" "pricing_unit" - , "approx_distinct"("Line_item_resource_id") "resource_id_count" , "sum"((CASE WHEN ("line_item_line_item_type" = 'SavingsPlanCoveredUsage') THEN "line_item_usage_amount" WHEN ("line_item_line_item_type" = 'DiscountedUsage') THEN "line_item_usage_amount" WHEN ("line_item_line_item_type" = 'Usage') THEN "line_item_usage_amount" ELSE 0 END)) "usage_quantity" , "sum"("line_item_unblended_cost") "unblended_cost" - , "sum"((CASE WHEN ("line_item_line_item_type" = 'SavingsPlanCoveredUsage') THEN "savings_plan_savings_plan_effective_cost" WHEN ("line_item_line_item_type" = 'SavingsPlanRecurringFee') THEN ("savings_plan_total_commitment_to_date" - "savings_plan_used_commitment") WHEN ("line_item_line_item_type" = 'SavingsPlanNegation') THEN 0 WHEN ("line_item_line_item_type" = 'SavingsPlanUpfrontFee') THEN 0 WHEN ("line_item_line_item_type" = 'DiscountedUsage') THEN "reservation_effective_cost" WHEN ("line_item_line_item_type" = 'RIFee') THEN ("reservation_unused_amortized_upfront_fee_for_billing_period" + "reservation_unused_recurring_fee") WHEN (("line_item_line_item_type" = 'Fee') AND ("reservation_reservation_a_r_n" <> '')) THEN 0 ELSE "line_item_unblended_cost" END)) "amortized_cost" FROM ${cur_table_name} WHERE ((("bill_billing_period_start_date" >= ("date_trunc"('month', current_timestamp) - INTERVAL '36' MONTH)) AND (CAST("concat"("year", '-', "month", '-01') AS date) >= ("date_trunc"('month', current_date) - INTERVAL '36' MONTH))) AND ("bill_billing_entity" = 'AWS Marketplace')) - 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 + GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21