Soru

Zorluk: OrtaManaging Networking Resources

A DevOps engineer needs to update an existing firewall rule named allow-internal-web in a custom Virtual Private Cloud (VPC) network. The rule currently filters traffic using the network tag legacy-web-backend. The team is migrating to identity-based security controls and requires the firewall rule to target instances using the service account [email protected] instead, while removing the existing network tag filter. Which gcloud command should the engineer execute to complete this operational change?

  1. gcloud compute firewall-rules update allow-internal-web --target-service-accounts=web-runner@prod-app.iam.gserviceaccount.com --remove-target-tags=legacy-web-backendCevap
  2. B
    gcloud compute firewall-rules update allow-internal-web [email protected]
  3. C
    gcloud compute firewall-rules create allow-internal-web --target-service-accounts=web-runner@prod-app.iam.gserviceaccount.com --force
  4. D
    gcloud compute firewall-rules update allow-internal-web --priority=65535 --direction=EGRESS

Cevap

Execute the command gcloud compute firewall-rules update allow-internal-web --target-service-accounts=web-runner@prod-app.iam.gserviceaccount.com --remove-target-tags=legacy-web-backend.
The correct command uses the `gcloud compute firewall-rules update` subcommand along with `--target-service-accounts` to set the service account identity and `--remove-target-tags` to clear the previous network tag target.

Adım Adım Çözüm

1
Identify the CLI tool and subgroup for managing VPC firewall rules.
Use the gcloud compute firewall-rules update command.
The requirement specifies modifying an existing firewall rule rather than creating a new one.
2
Specify the flags to assign service account identity and remove network tags.
Use --target-service-accounts to add the service account email and --remove-target-tags to strip the legacy tag.
VPC firewall rules allow targets to be defined by network tags or service accounts, and flags exist specifically to mutate these lists during an update.

Anahtar Kavram

Managing VPC Firewall Rules with gcloud CLI
Bu soruyu puanla