Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

google cloud - block incoming connections

Is there a way to block incoming connections to Google Cloud from a specific set of IP addresses?

Our company website is hosted on GCE and I'd like to block few IP addresses that are currently scraping our site. I couldn't find any options in the "Firewall" section in the GCE console.

Thanks! Alex

like image 941
Alex2326 Avatar asked Sep 30 '22 17:09

Alex2326


1 Answers

The firewall in GCE is used to 'allow' incoming traffic and unfortunately cannot be used to create 'block' rules. In summary, almost everything is blocked by default and you need to create rules to allow incoming traffic.

Instead, you can use the firewall on the VM itself. For example, if you're running a Linux instance you can look into iptables. Here's a Wikipedia article on it, but I highly recommend you go through the man pages for details. This way you can create a rule to block one particular IP address for example.

like image 112
Boyan Avatar answered Oct 05 '22 08:10

Boyan