
Ultimate access to all questions.
Deep dive into the quiz with AI chat providers.
We prepare a focused prompt with your quiz and certificate details so each AI can offer a more tailored, in-depth explanation.
Q2. You need Compute Engine VMs to communicate internally on TCP 8080. What is the correct approach?
A
Configure IAM roles
B
Create firewall rules allowing TCP 8080
C
Enable Cloud NAT
D
Use VPC Peering
Explanation:
For Compute Engine VMs to communicate internally on a specific port (TCP 8080), you need to create firewall rules that allow this traffic. Here's why:
Firewall rules control network traffic: In Google Cloud, firewall rules are used to allow or deny traffic to and from VM instances. By default, VPC networks have an implied "deny all" ingress rule and an "allow all" egress rule.
IAM roles vs Firewall rules:
Cloud NAT (Option C): Used for outbound internet connectivity for private instances, not for internal VM-to-VM communication.
VPC Peering (Option D): Used to connect different VPC networks, not for controlling traffic within the same VPC.
Correct approach: Create a firewall rule that:
Example firewall rule creation:
gcloud compute firewall-rules create allow-tcp-8080 \
--allow tcp:8080 \
--direction INGRESS \
--network default \
--source-ranges 10.128.0.0/9
gcloud compute firewall-rules create allow-tcp-8080 \
--allow tcp:8080 \
--direction INGRESS \
--network default \
--source-ranges 10.128.0.0/9
This rule would allow internal communication on TCP port 8080 within the VPC network.