Question

Difficulty: HardManaging Networking Resources

A Cloud Operations engineer is managing networking resources in a Google Cloud Virtual Private Cloud (VPC) network. To audit network traffic for an upcoming security compliance review, the engineer needs to enable VPC Flow Logs on an existing subnet named `sb-analytics` located in the `us-east1` region. The operational policy specifies that the aggregation interval must be set to 5 minutes (5 min5\text{ min}) and the sampling rate must capture 50%50\% of traffic (0.50.5). Which `gcloud` command must the engineer execute to correctly update the subnet configuration?

  1. gcloud compute networks subnets update sb-analytics --region=us-east1 --enable-flow-logs --logging-aggregation-interval=interval-5-min --logging-sample-rate=0.5Answer
  2. B
    gcloud compute networks subnets update sb-analytics --region=us-east1 --enable-flow-logs --logging-aggregation-interval=5m --logging-sample-rate=50
  3. C
    gcloud compute networks update prod-vpc --subnet=sb-analytics --enable-flow-logs --logging-sampling=0.5
  4. D
    gcloud compute subnets enable-logs sb-analytics --region=us-east1 --interval=5min --rate=0.5

Answer

The correct command is `gcloud compute networks subnets update sb-analytics --region=us-east1 --enable-flow-logs --logging-aggregation-interval=interval-5-min --logging-sample-rate=0.5`.
The correct command uses the proper resource command group `gcloud compute networks subnets update`, specifies the required `--region=us-east1` flag, enables logging with `--enable-flow-logs`, sets the aggregation interval to the accepted enum `interval-5-min`, and expresses the 50% sample rate as a decimal float `0.5`.

Step-by-Step Solution

1
Identify the target Google Cloud CLI resource command group for subnets
VPC subnet operations are managed under `gcloud compute networks subnets`.
Subnets belong to regional compute network resources in the CLI hierarchy.
2
Determine the required operation and flags for updating existing subnet configurations
Use `update sb-analytics --region=us-east1` with `--enable-flow-logs`.
Modifying existing resources requires the `update` subcommand along with mandatory regional scoping.
3
Validate the parameter flag names and acceptable value types for VPC Flow Logs settings
`--logging-aggregation-interval` requires acceptable enum values (`interval-5-sec`, `interval-30-sec`, `interval-1-min`, `interval-5-min`, `interval-15-min`), and `--logging-sample-rate` requires a floating-point value between 0.00.0 and 1.01.0 (0.50.5 for 50%50\%).
Passing invalid string formats or integer percentages causes CLI parser errors.

Key Concept

VPC Subnet Operations & Flow Logs Configuration via gcloud CLI
Estimated Time:2m 0s
Rate this question