Uses of Flow Logs
Steps to find top contributors to traffic on NAT Gateway
1. Enable VPC Flow Logs for VPC or NAT gateway.
2. Navigate to Cloud Watch console → Insights → from dropdown select log group of NAT Gateway.
3. To find which instances are sending the most traffic through your NAT gateway, run the following query.
filter(dst Addr like ‘x.x.x.x’ and src Addr like ‘y.y.’) | stats sum(bytes) as bytes Transferred by srcAddr, dst Addr | sort bytes Transferred desc | limit 10
Note: replace ‘x.x.x.x’ with private IP of NAT Gateway and ‘y.y.’ with first two octate of VPC CIDR range.
4. To find the internet destinations that the instances in VPC communicate with most often, run the following queries.
For Uploads: filter (srcAddr like ‘x.x.x.x’ and dstAddr not like ‘y.y.’) | stats sum(bytes) as bytes Transferred by src Addr, dst Addr | sort bytes Transferred desc | limit 10
For Downloads: filter(dstAddr like ‘x.x.x.x’ and srcAddr not like ‘y.y.’) | stats sum(bytes) as bytes Transferred by srcAddr, dstAddr | sort bytes Transferred desc | limit 10
Find which instance is sending the most traffic through NAT gateway.If that instance and NAT gateway are in different Availability Zones.Then create NAT Gateway on same AZ where that instannce is created.It will reduce data transfer cost in cross AZ.
Find the internet destination that the instances in VPC communicate with most often. If most traffic through NAT gateway is to AWS services that
support interface VPC endpoints, then create an interface VPC aendpoint for the service.
Find the internet destination that the instances in VPC communicate with most often. If most traffic through NAT gateway is to S3 Service or Amazon DynamoDB in the same Region. Then set-up a gateway VPC endpoint. Route traffic to and from the AWS resource through the gateway VPC endpoint, rather than through the NAT gateway.
© 2024. All rights reserved by Groots Software.