error opening a port in Google Compute Engine

坚强是说给别人听的谎言 提交于 2019-12-25 02:55:28

问题


I am trying to open a port via ssh in my VM instance in Google Compute engine but I keep getting error messages.

Here is my command:

myname@instance-2:~$ gcloud compute firewall-rules create baasbox-console-port --allow tcp:9000 --source-range
s=0.0.0.0/0

here is the error message:

NAME NETWORK SRC_RANGES RULES SRC_TAGS TARGET_TAGS
ERROR: (gcloud.compute.firewall-rules.create) Some requests did not succeed:
 - Insufficient Permission

pls what am i doing wrong?


回答1:


gcloud auth login Go to the following link in your browser: (Cut and past the link into your browser address bar) For me (Ubuntu 14.04) this does not return a verification code on FireFox, use Chromium. You should get a long string of characters as a verification code. Cut and past this into the terminal. I would then see this:

ERROR: There was a problem with web authentication.ERROR: (gcloud.auth.login) invalid_grant

After several tries of generating the code and pasting it, I copied the code and the trailing colon(:) then it worked




回答2:


You need to do either of the following:

  1. run gcloud auth login in your instance, or

  2. when you create your VM, you need to give it read-write access to Google Cloud Platform APIs by adding the compute-rw scope as follows:

    gcloud compute instances create $VM --scopes compute-rw [...]
    

    See the gcloud compute instances create docs for more info.



来源:https://stackoverflow.com/questions/31596998/error-opening-a-port-in-google-compute-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!