gcloud compute packet-mirrorings create NAME --collector-ilb=COLLECTOR_ILB --network=NETWORK [--async] [--description=DESCRIPTION] [--no-enable] [--filter-cidr-ranges=[CIDR_RANGE,…]] [--filter-direction=DIRECTION] [--filter-protocols=[PROTOCOL,…]] [--mirrored-instances=[INSTANCE,…]] [--mirrored-subnets=[SUBNET,…]] [--mirrored-tags=[TAG,…]] [--region=REGION] [GCLOUD_WIDE_FLAG …]
gcloud compute packet-mirrorings create my-pm --network my-network --region us-central1 --mirrored-subnets my-subnet --collector-ilb collector-fr --filter-protocols tcpMirror all traffic between instances with tag t1 and external server with IP 11.22.33.44 in us-central1, and send the mirrored traffic to the collector-fr Forwarding Rule.
gcloud compute packet-mirrorings create my-pm --network my-network --region us-central1 --mirrored-tags t1 --collector-ilb collector-fr --filter-cidr-ranges 11.22.33.44/32NAME--collector-ilb=COLLECTOR_ILB--network=NETWORK--async--description=DESCRIPTION--enable--no-enable to disable.
--filter-cidr-ranges=[CIDR_RANGE,…]--filter-direction=DIRECTIONingress, only ingress traffic is mirrored.
egress, only egress traffic is mirrored.
both (default), both directions are mirrored.
DIRECTION must be one of: both,
egress, ingress.
--filter-protocols=[PROTOCOL,…]--mirrored-instances=[INSTANCE,…]--mirrored-subnets=[SUBNET,…]--mirrored-tags=[TAG,…]To read more about configuring network tags, read this guide: https://cloud.google.com/vpc/docs/add-remove-network-tags
The virtual machines with the provided tags must live in zones contained in the same region as this packet mirroring.--region=REGIONcompute/region property value for this command invocation.
--access-token-file,
--account, --billing-project,
--configuration,
--flags-file,
--flatten, --format, --help, --impersonate-service-account,
--log-http,
--project, --quiet, --trace-token, --user-output-enabled,
--verbosity.
Run $ gcloud help for details.
gcloud alpha compute packet-mirrorings creategcloud beta compute packet-mirrorings creategcloud preview compute packet-mirrorings create
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-05-27 UTC.