0
0
GCPcloud~30 mins

Firewall rule components (target, source, protocol) in GCP - Mini Project: Build & Apply

Choose your learning style9 modes available
Firewall rule components (target, source, protocol)
📖 Scenario: You are setting up a simple firewall rule in Google Cloud Platform (GCP) to control network traffic for your virtual machines.This project will guide you to create a firewall rule with specific targets, sources, and protocols.
🎯 Goal: Create a GCP firewall rule configuration that specifies the target instances, source IP ranges, and allowed protocols.
📋 What You'll Learn
Create a dictionary named firewall_rule with keys for target tags, source ranges, and allowed protocols.
Add a configuration variable named allowed_protocol to specify the protocol to allow.
Use the allowed_protocol variable inside the firewall rule's allowed protocols list.
Complete the firewall rule dictionary with all required fields for a valid GCP firewall rule.
💡 Why This Matters
🌍 Real World
Firewall rules control network traffic to and from virtual machines in cloud environments, protecting resources from unwanted access.
💼 Career
Understanding firewall rule components is essential for cloud engineers and security specialists managing cloud infrastructure.
Progress0 / 4 steps
1
Create the initial firewall rule dictionary
Create a dictionary called firewall_rule with these exact keys and values: 'name' set to 'allow-ssh', 'targetTags' set to a list containing 'ssh-server', and 'sourceRanges' set to a list containing '0.0.0.0/0'.
GCP
Need a hint?

Use a dictionary with keys 'name', 'targetTags', and 'sourceRanges'. Each value should be exactly as specified.

2
Add the allowed_protocol variable
Create a variable called allowed_protocol and set it to the string 'tcp'.
GCP
Need a hint?

Just assign the string 'tcp' to the variable allowed_protocol.

3
Add the allowed protocols list using allowed_protocol
Add a key 'allowed' to the firewall_rule dictionary. Its value should be a list containing a dictionary with the key 'IPProtocol' set to the variable allowed_protocol.
GCP
Need a hint?

Use the allowed_protocol variable inside the list for the 'allowed' key.

4
Complete the firewall rule with description
Add a key 'description' to the firewall_rule dictionary with the value 'Allow SSH traffic' to complete the firewall rule configuration.
GCP
Need a hint?

Add a description to explain the purpose of the firewall rule.