Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud DevOps Engineer practice bank has 1,455 more like it. Try 10 free: instant score, no account.
Your DevOps team is investigating intermittent connectivity timeouts and potential egress policy violations between Compute Engine workloads in a production VPC network. You need to enable VPC Flow Logs across the entire network to analyze traffic patterns while strictly controlling Cloud Logging ingestion costs.
Your solution must meet the following requirements:
0.5) to balance visibility with log volume.src_instance,dst_instance).Which command should you execute to implement this configuration?
gcloud network-management vpc-flow-logs-configs create prod-vpc-flow-config --location=global --network=projects/my-prod-proj/global/networks/prod-vpc --aggregation-interval=interval-30-sec --flow-sampling=0.5 --metadata=custom-metadata --metadata-fields=src_instance,dst_instanceThe Network Management API provides centralized management for VPC Flow Logs configurations across entire VPC networks, organizations, or individual subnets. Creating a configuration using the gcloud network-management vpc-flow-logs-configs create command allows administrators to define network-wide telemetry policies with granular control over sampling rates, aggregation intervals, and metadata annotations.
--network=projects/my-prod-proj/global/networks/prod-vpc applies flow logging automatically across all present and future subnets in the VPC.--aggregation-interval=interval-30-sec batches and aggregates packet metrics over 30-second windows, providing granular visibility while decreasing logging churn.--flow-sampling=0.5 applies a secondary sampling rate of 50%, halving the volume of generated log entries to control ingestion costs.--metadata=custom-metadata along with --metadata-fields=src_instance,dst_instance restricts log record payload attributes strictly to the VM instance names, omitting unneeded fields.VpcFlowLogsService generate Admin Activity audit logs (CreateVpcFlowLogsConfig, UpdateVpcFlowLogsConfig), which are permanently enabled across Google Cloud by default at no extra cost.cloudaudit.googleapis.com/activity logs without requiring custom Data Access logging policies.Using the Network Management API with custom metadata flags precisely satisfies all observability and cost-optimization constraints while relying on default platform Admin Activity audit logging.
gcloud network-management vpc-flow-logs-configs create prod-vpc-flow-config --location=global --network=projects/my-prod-proj/global/networks/prod-vpc --aggregation-interval=interval-30-sec --flow-sampling=50 --metadata=exclude-all-metadata --metadata-fields=src_instance,dst_instanceThis command attempts to create a VPC Flow Logs configuration using the Network Management API but supplies conflicting and invalid parameters for sampling and metadata settings.
--flow-sampling parameter accepts a floating-point value between 0.0 and 1.0 (where 1.0 represents 100%). Passing integer 50 violates parameter validation and causes the command execution to fail.--metadata=exclude-all-metadata instructs Google Cloud to strip all metadata annotations from the flow log records. Specifying --metadata-fields alongside exclude-all-metadata is invalid, as --metadata-fields is strictly allowed only when --metadata is explicitly set to custom-metadata.src_instance and dst_instance attributes, preventing effective identification of the communicating workloads during troubleshooting.flowSampling) is defined as a ratio between 0.0 and 1.0, not a percentage integer.--metadata-fields cannot override or coexist with exclude-all-metadata or include-all-metadata.The goal was to completely eliminate all metadata annotations to achieve the absolute lowest log payload size and --flow-sampling was properly formatted as 0.5 without passing --metadata-fields.
gcloud compute networks subnets update prod-subnet --enable-flow-logs --logging-aggregation-interval=interval-30-sec --logging-flow-sampling=0.5 --logging-metadata=include-all-metadataThis command uses the legacy Compute Engine API (gcloud compute networks subnets update) to enable flow logs on a single specified subnetwork (prod-subnet) with full metadata inclusion.
--logging-metadata=include-all-metadata includes all available annotations (such as pod CIDRs, service names, and geographic endpoints), violating the requirement to capture only source and destination instance details and increasing log ingestion costs.include-all-metadata captures large amounts of supplementary networking headers, substantially driving up Cloud Logging ingestion billing.The requirement was to selectively enable flow logs on a single isolated subnet rather than across the entire VPC network and all metadata fields were required for deep protocol inspection.
gcloud network-management vpc-flow-logs-configs create prod-vpc-flow-config --location=global --network=projects/my-prod-proj/global/networks/prod-vpc --aggregation-interval=interval-30-sec --flow-sampling=0.5 --metadata=custom-metadata --metadata-fields=src_instance,dst_instance and explicitly enable Data Access audit logs for the Network Management API.This command correctly configures the VPC Flow Logs parameters, but it introduces an unnecessary administrative step by mandating the manual enablement of Data Access audit logs for tracking configuration updates.
CreateVpcFlowLogsConfig, UpdateVpcFlowLogsConfig, or DeleteVpcFlowLogsConfig) falls under Admin Activity audit logs, which are enabled by default and cannot be disabled.ADMIN_READ (e.g., GetVpcFlowLogsConfig, ListVpcFlowLogsConfigs), DATA_READ, and DATA_WRITE operations. They are not required to track administrative changes, creates, or deletions.The organization specifically mandated compliance auditing of read-only API inspection calls (GetVpcFlowLogsConfig or ListVpcFlowLogsConfigs) in addition to tracking administrative modification events.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated Validated