Skip to content

Instantly share code, notes, and snippets.

@brianfrantz
Created December 1, 2023 19:16
Show Gist options
  • Save brianfrantz/c08801607af3b3e82af56b9a04b8c7c7 to your computer and use it in GitHub Desktop.
Save brianfrantz/c08801607af3b3e82af56b9a04b8c7c7 to your computer and use it in GitHub Desktop.
Snowflake Schema for AWS Cost and Usage Reports (CUR 2.0)
create or replace TABLE OMNI_ANALYTICS.AWS_COST_REPORTS.AWS_COST_AND_USAGE_DATA (
"bill_bill_type" VARCHAR(16777216),
"bill_billing_entity" VARCHAR(16777216),
"bill_billing_period_end_date" TIMESTAMP_NTZ(9),
"bill_billing_period_start_date" TIMESTAMP_NTZ(9),
"bill_invoice_id" VARCHAR(16777216),
"bill_invoicing_entity" VARCHAR(16777216),
"bill_payer_account_id" NUMBER(12,0),
"bill_payer_account_name" VARCHAR(16777216),
"cost_category" VARCHAR(16777216),
"discount" VARCHAR(16777216),
"discount_bundled_discount" VARCHAR(16777216),
"discount_total_discount" VARCHAR(16777216),
"identity_line_item_id" VARCHAR(16777216),
"identity_time_interval" VARCHAR(16777216),
"line_item_availability_zone" VARCHAR(16777216),
"line_item_blended_cost" NUMBER(17,10),
"line_item_blended_rate" VARCHAR(16777216),
"line_item_currency_code" VARCHAR(16777216),
"line_item_legal_entity" VARCHAR(16777216),
"line_item_line_item_description" VARCHAR(16777216),
"line_item_line_item_type" VARCHAR(16777216),
"line_item_net_unblended_cost" NUMBER(17,10),
"line_item_net_unblended_rate" VARCHAR(16777216),
"line_item_normalization_factor" NUMBER(17,10),
"line_item_normalized_usage_amount" NUMBER(17,10),
"line_item_operation" VARCHAR(16777216),
"line_item_product_code" VARCHAR(16777216),
"line_item_tax_type" VARCHAR(16777216),
"line_item_unblended_cost" NUMBER(17,10),
"line_item_unblended_rate" VARCHAR(16777216),
"line_item_usage_account_id" NUMBER(12,0),
"line_item_usage_account_name" VARCHAR(16777216),
"line_item_usage_amount" VARCHAR(16777216),
"line_item_usage_end_date" TIMESTAMP_NTZ(9),
"line_item_usage_start_date" TIMESTAMP_NTZ(9),
"line_item_usage_type" VARCHAR(16777216),
"pricing_currency" VARCHAR(16777216),
"pricing_lease_contract_length" VARCHAR(16777216),
"pricing_offering_class" VARCHAR(16777216),
"pricing_public_on_demand_cost" NUMBER(17,10),
"pricing_public_on_demand_rate" VARCHAR(16777216),
"pricing_purchase_option" VARCHAR(16777216),
"pricing_rate_code" VARCHAR(16777216),
"pricing_rate_id" NUMBER(12,0),
"pricing_term" VARCHAR(16777216),
"pricing_unit" VARCHAR(16777216),
"product" VARCHAR(16777216),
"product_comment" VARCHAR(16777216),
"product_fee_code" VARCHAR(16777216),
"product_fee_description" VARCHAR(16777216),
"product_from_location" VARCHAR(16777216),
"product_from_location_type" VARCHAR(16777216),
"product_from_region_code" VARCHAR(16777216),
"product_instance_family" VARCHAR(16777216),
"product_instance_type" VARCHAR(16777216),
"product_instancesku" VARCHAR(16777216),
"product_location" VARCHAR(16777216),
"product_location_type" VARCHAR(16777216),
"product_operation" VARCHAR(16777216),
"product_pricing_unit" VARCHAR(16777216),
"product_product_family" VARCHAR(16777216),
"product_region_code" VARCHAR(16777216),
"product_servicecode" VARCHAR(16777216),
"product_sku" VARCHAR(16777216),
"product_to_location" VARCHAR(16777216),
"product_to_location_type" VARCHAR(16777216),
"product_to_region_code" VARCHAR(16777216),
"product_usagetype" VARCHAR(16777216),
"reservation_amortized_upfront_cost_for_usage" NUMBER(17,10),
"reservation_amortized_upfront_fee_for_billing_period" NUMBER(17,10),
"reservation_availability_zone" VARCHAR(16777216),
"reservation_effective_cost" NUMBER(17,10),
"reservation_end_time" VARCHAR(16777216),
"reservation_modification_status" VARCHAR(16777216),
"reservation_net_amortized_upfront_cost_for_usage" NUMBER(17,10),
"reservation_net_amortized_upfront_fee_for_billing_period" NUMBER(17,10),
"reservation_net_effective_cost" NUMBER(17,10),
"reservation_net_recurring_fee_for_usage" NUMBER(17,10),
"reservation_net_unused_amortized_upfront_fee_for_billing_period" NUMBER(17,10),
"reservation_net_unused_recurring_fee" NUMBER(17,10),
"reservation_net_upfront_value" NUMBER(17,10),
"reservation_normalized_units_per_reservation" VARCHAR(16777216),
"reservation_number_of_reservations" VARCHAR(16777216),
"reservation_recurring_fee_for_usage" NUMBER(17,10),
"reservation_reservation_a_r_n" VARCHAR(16777216),
"reservation_start_time" TIMESTAMP_NTZ,
"reservation_subscription_id" VARCHAR(16777216),
"reservation_total_reserved_normalized_units" VARCHAR(16777216),
"reservation_total_reserved_units" VARCHAR(16777216),
"reservation_units_per_reservation" VARCHAR(16777216),
"reservation_unused_amortized_upfront_fee_for_billing_period" NUMBER(17,10),
"reservation_unused_normalized_unit_quantity" NUMBER(12,0),
"reservation_unused_quantity" NUMBER(12,0),
"reservation_unused_recurring_fee" NUMBER(17,10),
"reservation_upfront_value" NUMBER(17,10),
"resource_tags" VARCHAR(16777216),
"savings_plan_amortized_upfront_commitment_for_billing_period" NUMBER(17,10),
"savings_plan_end_time" TIMESTAMP_NTZ(9),
"savings_plan_instance_type_family" VARCHAR(16777216),
"savings_plan_net_amortized_upfront_commitment_for_billing_period" VARCHAR(16777216),
"savings_plan_net_recurring_commitment_for_billing_period" VARCHAR(16777216),
"savings_plan_net_savings_plan_effective_cost" NUMBER(17,10),
"savings_plan_offering_type" VARCHAR(16777216),
"savings_plan_payment_option" VARCHAR(16777216),
"savings_plan_purchase_term" VARCHAR(16777216),
"savings_plan_recurring_commitment_for_billing_period" NUMBER(17,10),
"savings_plan_region" VARCHAR(16777216),
"savings_plan_savings_plan_a_r_n" VARCHAR(16777216),
"savings_plan_savings_plan_effective_cost" NUMBER(17,10),
"savings_plan_savings_plan_rate" VARCHAR(16777216),
"savings_plan_start_time" TIMESTAMP_NTZ(9),
"savings_plan_total_commitment_to_date" NUMBER(17,10),
"savings_plan_used_commitment" NUMBER(17,10)
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment