Category Archives: Google Cloud

Google Cloud Load Balancer Firewall Rules

If you need to create firewall rules related to Google Load Balancer: You must create a firewall rule that allows traffic from 130.211.0.0/22 and 35.191.0.0/16 to reach your instances. This rule allows traffic from both the load balancer and the health checker. The rule must allow traffic on the port your global forwarding rule has […]

Create Instance Template out of Disk Snapshot on Google Cloud

You can create an Instance Template out of disk snapshot like this: 1) Created an instance 2) Install the required services on that instance 3) Create the image from the disk using the steps mentioned on this link. 4) With that Image create a new template. Other simpler steps recommended by an user: 1) Create […]

Get User IP Address From Google Cloud Load Balancer

Google Cloud Load Balancer saves the user’s IP in the X-Forwarded-For field: X-Forwarded-For: -client IP(s)-, -global forwarding rule external IP-X-Forwarded-For: -client IP(s)-, -global forwarding rule external IP- More information can be found here: https://cloud.google.com/load-balancing/docs/https/ Here is a sample PHP snippet to get the user’s IP address: $user_ip = explode(",", $_SERVER[‘HTTP_X_FORWARDED_FOR’])[0]; print_r($user_ip);$user_ip = explode(",", $_SERVER[‘HTTP_X_FORWARDED_FOR’])[0]; print_r($user_ip);

Connect as Root using WinSCP on Google Cloud Compute Engine

To connect as root with your Compute Engine VM using WinSCP do this: Option 1: Using Session -> File Protocol -> SCP sudo su -sudo su – Option 2: Using Session -> File Protocol -> SFTP sudo -s /usr/lib/sftp-serversudo -s /usr/lib/sftp-server

Connect to Google Cloud Compute Engine VM via PuTTY SSH

First you need to create an SSH key (use PuTTyGen.exe). Then on Google Cloud click on Compute Engine -> Metadata -> SSH Keys. Add there your generate SSH key and click on “Save” button. Then open PuTTy and in “Host Name” field enter: [username]@[external_IP][username]@[external_IP] Where username will be the same as the one used to […]