AWS Builder Center
Find the IP pairs behind your cross-AZ data transfer bill (Part 3): Amazon Quick Sight dashboard, fixes and production use

Find the IP pairs behind your cross-AZ data transfer bill (Part 3): Amazon Quick Sight dashboard, fixes and production use

Turn the cross-AZ cost estimates from Parts 1 and 2 into an Amazon Quick Sight dashboard, act on the most expensive IP pairs, and learn what changes when you move from the lab to production, including deploying everything as code from the companion repository.

In  Part 2  you processed the enriched VPC Flow Logs and created an Amazon Athena view with cross-AZ traffic and its estimated cost per pair of IP addresses, and you learned why each flow has to be counted once across the network interfaces that log it, and why traffic through a Transit Gateway is billed differently. This part makes the results easy to read and act on, and covers what changes when you leave the lab.

What you'll learn

  • How to build a Quick Sight dashboard with cost KPIs, an IP-to-IP heat map and a detail table
  • Which fixes remove cross-AZ cost, and which flows are worth paying for
  • What to check before you point the pipeline at production VPCs
  • How to deploy the whole pipeline with one CloudFormation template, and remove it with one script
Required source: Summary tabs are explanations, not executable code. Open Complete SQL and copy the full dataset query before continuing.

Prerequisites

  • The pipeline from Part 2, with at least one Glue run completed and the  cross_az_analytics.flows  view created.
  • An Amazon Quick Sight account with an Author or Admin user in the same Region ( sign up ). A standard Author is enough. Pro users or Q&A features add a $250/month account fee ( pricing ).
  • For the CLI commands, use the same shell variables as the earlier setup ( AWS_REGION ,  ACCOUNT_ID ,  BUCKET ).
All code, policies, SQL and templates from all three parts are in the  companion repository .

Step 7: Build the Quick Sight dashboard

7a. Allow Quick Sight to read the data

Console: In Quick Sight, open your user menu → Manage account → AWS resources. Check Amazon Athena. Under Amazon S3, choose Select S3 buckets, select your  cross-az-analytics-...  bucket and check Write permission for Athena Workgroup, because Athena writes query results there. Choose Save.

Quick Sight AWS resources page showing the Athena workgroup and S3 bucket access settings

This page changes the Quick-managed role for the whole Quick Sight account. In a shared account, leave it alone and use the CloudFormation alternative at the end of this step: it creates a separate IAM role scoped to your bucket.

7b. Create the dataset

  1. Datasets → New dataset → Athena. Data source name  cross-az-athena , workgroup  primary  → Create data source.
  1. Use custom SQL, paste the query below, name it  Cross-AZ traffic by IP pair  → Confirm query.
  1. Directly query your data, so the dashboard always shows the latest hour → Visualize.
The dataset query aggregates each IP pair by day, path and AZ, with traffic volume and separate cross-AZ and Transit Gateway cost estimates.

> Select the **Complete SQL** tab to view and copy the full SQL.



7c. Add the visuals

Visual
Field wells
KPI "Cross-AZ data transfer (USD)"
Value:  cross_az_transfer_usd  (Sum)
KPI "Transit Gateway processing (USD)"
Value:  tgw_processing_usd  (Sum)
Horizontal bar "Traffic volume (GB) by path"
Y axis:  traffic_path , Value:  total_gb  (Sum)
Heat map "Traffic volume (GB): source IP to destination IP"
Rows:  srcaddr , Columns:  dstaddr , Values:  total_gb  (Sum)
Table "IP pairs: path, volume and estimated cost"
Group by:  srcaddr ,  src_subnet_name ,  src_az_id ,  dstaddr ,  dst_subnet_name ,  dst_az_id ,  traffic_path . Values:  total_gb ,  cross_az_transfer_usd ,  tgw_processing_usd  (Sum), sorted by  total_gb  descending
Add a filter on  flow_day  (Filter → Add filter → flow_day → Relative dates) to compare periods, for example before and after you move a workload. Then Publish → Publish new dashboard.

Quick Sight dashboard with cost KPIs, an IP-to-IP heat map and the detail table

CloudFormation alternative (also for shared accounts)
 quicksight.yaml  creates the data source with its own scoped IAM role, the dataset and this dashboard, shared with your user:
aws quicksight list-users --aws-account-id $ACCOUNT_ID --namespace default --query 'UserList[].[UserName,Arn]' --output table
aws cloudformation deploy --stack-name CrossAzAnalyticsQuickSight --template-file quicksight.yaml \
--capabilities CAPABILITY_IAM --parameter-overrides QuickSightUserArn=<your-user-arn> BucketName=$BUCKET

Taking action

Start with the heat-map cells that also have a cross-AZ cost in the table. Typical fixes:
  • Zonal NAT gateways. One NAT gateway per AZ, with each private subnet routed to the one in its own AZ. Add gateway VPC endpoints for Amazon S3 and Amazon DynamoDB so that traffic skips the NAT gateway entirely.
  • Keep consumers next to producers. Place chatty services in the same AZ, or run one consumer per AZ with zonal endpoints, for example Elastic Load Balancing with cross-zone load balancing turned off.
  • Read locally. Use Amazon RDS, Amazon Aurora or Amazon ElastiCache replicas in the client's AZ, with AZ-aware clients.
  • Kubernetes. Use topology-aware routing so services prefer endpoints in the same zone.
Not every cross-AZ flow is waste: replication between AZs is often exactly what you're paying for. The point is to see the cost per flow, so you can decide which flows are worth it.

Suggested analyses

  • Compare with your bill. Join the results with your Cost and Usage Report, or the data transfer views of the  Cloud Intelligence Dashboards , to compare the estimate with actual  DataTransfer-Regional-Bytes  charges.
  • Name the workloads. Extend the Lambda function to label instances, load balancers, EKS pods or VPC endpoints, so the heat map shows service names. Or add the flow log tag fields ( instance-tag ,  interface-tag ,  asg-tag  and their  -2  variants), which put up to two tag values per resource type into each record. They create a service-linked role and EventBridge managed rules in your account.
  • Newer flow log fields.  Flow log version 11  (June 2026) adds  interface-type , which says whether the logging ENI belongs to a Transit Gateway, NAT gateway, Network Load Balancer or VPC endpoint. It could replace the Transit Gateway ENI list that the Lambda function builds. It also adds next-hop fields such as  next-hop-az-id  and  next-hop-vpc-id . These don't replace the subnet lookup. Through a Transit Gateway, the next hop is the attachment ENI, not the destination. The fields are also empty for ingress from a Transit Gateway or Network Load Balancer, for traffic to an internet gateway, and across Regions ( limitations ).
  • NAT gateway attribution. Requests from an instance to the internet are logged with the internet address as destination, so the client → NAT gateway leg shows as external. The larger NAT gateway → client leg (downloads) is attributed, as the NAT gateway rows in Part 2 showed.

Lab versus production

The lab has predictable traffic and a small network. Before you point the pipeline at real VPCs, check these points (some expand on "Notes for your own VPCs" in Part 1):
  • Flow log volume and cost. Flow logs to S3 are billed per GB delivered. Turn them on for one VPC for a day, look at the size under  flow-logs/ , and only then add more VPCs. Use the 9 required fields rather than the 23 in the post if volume matters.
  • Data retention and access. The bucket holds IP addresses per connection. The lifecycle rules expire raw logs after 30 days and query results after 7; the enriched data under  processed/  is kept until you delete it. Apply your organisation's retention and access rules to the bucket, and restrict who can run Athena queries against the  cross_az_analytics  database.
  • Bigger networks. Parameter Store holds about 60 subnets with labels. Beyond that, write the map to S3 and read it in the Glue job; the lookup logic stays the same.
  • Many accounts. Deliver flow logs from every account to one central bucket, and build the network map with a role in each account or from Amazon VPC IP Address Manager.
  • Regional NAT gateways and VPC peering change how records look and how traffic is billed; see "Notes for your own VPCs" in Part 1.
  • Job sizing. Two G.1X workers process a lab hour in under two minutes. For busy VPCs watch the run time in the Glue console and add workers, or run the job less often with Flex execution to cut cost.
  • Bucket hardening. The CloudFormation template below enables versioning, server access logging and a TLS-only bucket policy. Add the same settings to a console-built bucket if your standards require them.

Deploy it as code

Non-production sample: Review and adapt the IAM permissions, network controls, encryption, retention, monitoring and deletion behavior with your security and legal teams before deployment.
If you want to repeat the setup in another account or Region,  vpc-analytics-stack.yaml  in the repository creates the capture and enrichment resources in one CloudFormation stack, plus a dedicated Athena workgroup  cross-az-analytics  with the view and the cost query as saved queries:
aws cloudformation deploy --stack-name CrossAzAnalytics --template-file vpc-analytics-stack.yaml \
--capabilities CAPABILITY_NAMED_IAM --parameter-overrides VPCAId=$VPC_A VPCBId=$VPC_B
aws s3 cp cross-az-flowlogs-enrichment.py s3://$BUCKET/scripts/
After the first job run, execute the two saved queries in the  cross-az-analytics  workgroup, then deploy  quicksight.yaml  with  AthenaWorkGroupName=cross-az-analytics . The stack uses the same resource names as the console build (except the Glue role,  CrossAzGlueJobRole-<region> , because IAM names are account-wide), so don't deploy it next to a console-built copy in the same Region. In a second Region of the same account, skip the lab's  pre-requisites.yaml : its named instance profile already exists.
 undeploy.sh  removes the pipeline and optional lab stacks whichever way you built them; it also removes Quick Sight when deployed by  quicksight.yaml . Console-built Quick Sight assets require manual deletion. Run  DRY_RUN=1 bash undeploy.sh --lab  first and review every target. To delete the pipeline and lab network, run  CONFIRM_DELETE="$ACCOUNT_ID:$AWS_REGION:$BUCKET" bash undeploy.sh --lab ; the token binds cleanup to the displayed account, Region and bucket.

Cost of Part 3

Quick Sight Author $24/user/month, Reader $3/user/month (us-east-1 list prices). The dataset uses direct query, so no SPICE capacity is needed. The pipeline itself is costed in Part 2.

Clean up

 undeploy.sh  (above) handles the pipeline, optional lab stacks and the CloudFormation Quick Sight variant. Delete console-built Quick Sight assets manually. In the console:
  1. Quick Sight: delete the dashboard, analysis, dataset and data source, or the  CrossAzAnalyticsQuickSight  stack.
  1. VPC: delete the  cross-az-analytics  flow logs on each VPC (Flow logs tab → Actions → Delete flow logs).
  1. Glue: delete the schedule  cross-az-flowlogs-hourly  (job → Schedules tab), the job  cross-az-flowlogs-enrichment  and the database  cross_az_analytics , which removes the table and the view.
  1. Athena: delete the saved query  cross-az-cost-by-ip-pair . If you set the query result location in Step 6, point it somewhere else before the bucket goes.
  1. Lambda and Parameter Store: delete  cross-az-subnet-mapper ,  /cross-az/subnet-map  and the log group  /aws/lambda/cross-az-subnet-mapper .
  1. IAM: delete the roles  CrossAzGlueJobRole  and  cross-az-subnet-mapper-role-... . The console removes their inline policies with them; the  AWSLambdaBasicExecutionRole-...  policy that Lambda created stays under Policies until you delete it.
  1. S3: empty and delete the  cross-az-analytics-...  bucket, and the job script under  aws-glue-assets-.../scripts/ .
  1. Lab only: delete the stacks  CrossAzDemoClients ,  NetworkingWorkshopMultiVPCandTGW  and  NetworkingWorkshopPrerequisites , in that order.

Resources

Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article