Question

Difficulty: EasyManaging Networking Resources

An administrator needs to allow incoming traffic on TCP port 8443 for an existing firewall rule named app-ingress in a Google Cloud Virtual Private Cloud (VPC). Which gcloud command should be executed to modify this existing firewall rule?

  1. gcloud compute firewall-rules update app-ingress --allow tcp:8443Answer
  2. B
    gcloud compute networks update app-ingress --allow tcp:8443
  3. C
    gcloud compute firewall-rules create app-ingress --allow tcp:8443
  4. D
    gcloud compute firewall-rules add app-ingress --ports tcp:8443

Answer

The command 'gcloud compute firewall-rules update app-ingress --allow tcp:8443' correctly modifies the existing rule to allow traffic on port 8443.
To modify an existing Google Cloud firewall rule, the command group 'gcloud compute firewall-rules update' must be used along with the '--allow' parameter specifying the target protocol and port.

Step-by-Step Solution

1
Identify the target resource group in the gcloud CLI
Firewall rules in GCP are managed under 'gcloud compute firewall-rules'.
Networking firewall rules belong to the compute service group.
2
Determine the correct verb for modifying an existing configuration
The verb 'update' is used to change existing resources, whereas 'create' is used for new resources.
Attempting to create an existing rule will result in a resource conflict error.
3
Select the proper flag to specify allowed protocols and ports
The flag '--allow tcp:8443' specifies protocol tcp and port 8443.
The '--allow' flag accepts protocol:port format.

Key Concept

Modifying existing VPC firewall rules using gcloud compute firewall-rules update
Rate this question