Skip to content

Instantly share code, notes, and snippets.

@tamsky
Last active November 29, 2024 05:12
Show Gist options
  • Save tamsky/c0fd2fdd90277c748ba4ae5e0e301a8d to your computer and use it in GitHub Desktop.
Save tamsky/c0fd2fdd90277c748ba4ae5e0e301a8d to your computer and use it in GitHub Desktop.
how to query cross-account peering traffic using AWS CUR (cost usage reporting)

https://repost.aws/questions/QUPsJThdNjRaWfjwujTsl9gA/vpc-peering-traffic-volume-mismatch-between-origin-and-destination-vpc

SELECT DISTINCT
     "line_item_product_code"
   , "bill_billing_period_start_date"
   , "bill_payer_account_id"
   , "product_product_name"
   , "line_item_line_item_type"
   , "line_item_operation"
   , "product_region"
   , "line_item_usage_type"
   , "product_from_location"
   , "product_to_location"
   , "line_item_resource_id"
   , ("sum"("line_item_usage_amount") / 1024) "TB's"
   , "sum"("line_item_blended_cost") "cost"
   FROM
     customer_cur_data.customer_all
   WHERE "line_item_operation" LIKE '%VPCPeering%'
   GROUP BY "line_item_product_code", "bill_billing_period_start_date", "bill_payer_account_id", "product_product_name", "line_item_line_item_type", "line_item_operation", "product_region", "line_item_usage_type", "product_from_location", "product_to_location", "line_item_resource_id"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment