Skip to main content

Command Palette

Search for a command to run...

Bash Script to Enable VPC Flow Logs on all subnets in a GCP Project

Updated
1 min read
Bash Script to Enable VPC Flow Logs on all subnets in a GCP Project

Here's a super simple bash script to enable VPC flow logs on every subnet across a specified GCP project with an option to include or exclude logging metadata that I wrote. It has the aggregation interval set to 10-min however, you could modify this to your needs in addition to setting additional flags available for the VPC flow log settings.

Here are some use cases for enabling VPC flow logs:

  • Network monitoring: diagnostics and capacity forecasting

  • Network traffic optimization expenses: inter-region and zone traffic analysis

  • Network forensics: examine compromised IPs

  • Real-time security analysis: SIEM integration

Link to script: https://github.com/jksprattler/gcp-networking/blob/main/scripts/enable-flowlogs.sh

More from this blog

Jenna's Runbooks

24 posts

Writing about topics such as Multi-Cloud Infrastructure, Security, DevOps, Networking, and Automation on AWS, Azure, and GCP