Unable to connect to R Studio Server in browser

I've set up RStudio on my Google Cloud Platform (GCP) instance via Linus Debian V9, and it all seems to have installed successfully: "sudo rstudio-server verify-installation" runs without fault.

Also on the GCP, I've also installed the Linux app for managing firewalls (sudo apt install ufw) and used it to open the 8787 channel (sudo ufw allow 8787), and I've also enabled access from my laptop (connected to internet via my university's network), with the following command: "sudo ufw allow from 34.73.184.XXX". note: last three letters X-d out).

Lastly, I've used "curl ifconfig.me" to check that I am using the correct IP address. This is the same IP address that appears on the GCP instance.

However, when I enter "http://34.73.184.XXX:8787" into my browser, it just times out: (error: This site can’t be reached. 34.73.184.XXX took too long to respond. ERR_CONNECTION_TIMED_OUT).

Can anyone help?


That is your local IP or public IP? if you are trying to access your server from outside your local network using your public IP, you need to configure port forwarding in your router/modem, if you are trying to access the server within the same local network then you need to use your local IP instead, because sometimes using the public IP within the local network creates some conflicts depending in your network´s hardware.

Thank you for your quick response!

I don't fully follow but will explain my situation and hopefully that can help.
So the server I've set up is on Google Cloud Platform (GCP). I used the 'external IP' that I can see on the GCP instance, and that I was shown by the ' curl ifconfig.me ' command on Linux, in the GCP instance.

I've tried to access it via a browser (Chrome) on my work PC (at a university, connected through the wired network).

So I suspect that a local IP is not relevant here as I'm trying to access the cloud server, but please tell me if otherwise.

I'll also update the question to include this info.

I have never used Google Cloud Platform but I'm almost sure that you need to open the 8787 port using the console for your instance (at least that is the case for AWS equivalent). After a quick googling I have found this steps.

  1. Go to cloud.google.com
  2. Go to my Console
  3. Choose your Project
  4. Choose Networking > VPC network
  5. Choose "Firewalls rules"
  6. Choose "Create Firewall Rule"
  7. To apply the rule to select VM instances, select Targets > "Specified target tags", and enter into "Target tags" the name of the tag. This tag will be used to apply the new firewall rule onto whichever instance you'd like. Then, make sure the instances have the network tag applied.
  8. To allow incoming TCP connections to port 8787, in "Protocols and Ports" enter tcp:8787
  9. Click Create

Thanks again Andresrcs,

I have followed your instructions and have successfully created this firewall rule.

However now I am unable to open my GCP terminal. I'm getting an error saying "Connection failed. We are unable to connect to the VM on port 22.".

I think it's unlikely that it's because of the new firewall rule. I'm still looking in to how to connect to the instance. I've tried connecting through the browser and also through putty and neither has worked so far.

If I may ask for further advice - is there a way to automate the setting up of RStudio on GCP so that (once I successfully connect), I don't have to go through the rigmarole of updating R, and installing R studio from scratch every time?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.