Virtual Private Cloud in Google Cloud Platform

Problem Statement
E1) Create a Virtual Private Network (VPC)
E2) Create a Firewall rule for allowing http
E3) Create a VM instance and host a website using apache web server.
E4) Create a Network tag in the firewall and associate it with the instance to verify it.
Solution E1
Step 1: From the Navigation bar navigate to the VPC Network console.
Step 2: Configure the VPC accordingly, here I have named it as gcp-wipro-rohit-vpc.
Step 3: Create subnets, name them and set the cidr ranges for the same.
Step 4: Create another subnet, name it and set the cidr ranges for the same. Click Done.
Step 5: Select the firewall rules, click on the checkbox to import all essential rules .
Step 6: The rules get selected .
Step 7: Keep all other settings to default and then click on Create.
The VPC network shows up on the page.
Solution E2
Step 1: Navigate to Firewall from the left pane of VPC Network.
Step 2: Click on Create Firewall Rule.
Step 3: Configure your Firewall accordingly, make sure you select the VPC you created under the Network section.
Step 4: Set the Targets to All instances in the network and the Source IPv4 ranges to 0.0.0.0/0 the quad zero route.
Step 5: Check the TCP option and mention the port 80 for http.
The firewall shows up on the firewall page.
Solution E3
Step 1: Navigate to the VM instance page.
Step 2: Configure your instance, here I have named it as gcp-wipro-rohit-vm.
Step 3: Under the Network Interfaces section click on the drop down button ahead of default.
Step 4: Under the Network section, select the VPC you created.
Step 5: Click on Done.
The VPC gets fixed.
Step 6: Click on Create.
The VM instance shows up on the VM instance page.
Step 7: Click on SSH and get into your instance.
Step 8: Set up apache web server to your instance.
Step 9: Edit the index.html file accordingly and host your website.
Step 10: Copy the External IP and paste it in another tab.
The apache web server works fine.
The website gets hosted successfully.
Solution E4
Step 1: Navigate to the firewall section of the VPC Network.
Step 2: Click on the name of your firewall which was created to allow http.
Step 3: Click on Edit.
Step 4: Under the Targets option select Specified target tags.
Step 5: Give a name to your target tag, here I have named it as apache-web.
Step 6: Click on Save.
The target gets displayed as apache web.
Step 7: Copy your External IP and try hitting on the IP.
The page keeps on loading.
It finally gives such output.
Step 8: Edit the VM instance by clicking on the Edit button after clicking on the name of the VM instance.
Step 9: Add the name of the tag you created under the network tags section and click on Save.
Step 10: Recheck the External IP and this time it works.
The website gets hosted successfully.
Thanks for giving it a read, Happy Reading! :)

Feel free to reach me out on LinkedIn or Twitter for any sort of suggestions or queries!