GCP Windows配置SDK

創建配置

PS C:\Users\>gcloud config configurations create test-project

Created [test-project].

Activated [test-project].

 

切換到配置文件

PS C:\Users\> gcloud config configurations activate test-project

 

初始化配置

PS C:\Users\> gcloud init

Welcome! This command will take you through the configuration of gcloud.

 

Settings from your current configuration [test-project] are:

core:

  disable_usage_reporting: 'True'

 

Pick configuration to use:

 [1] Re-initialize this configuration [test-project] with new settings

 [2] Create a new configuration

 [3] Switch to and re-initialize existing configuration: [default]

 [4] Switch to and re-initialize existing configuration: [test-project]

 

這裏選擇1

Please enter your numeric choice:  1

 

Your current configuration has been set to: [test-project]

 

You can skip diagnostics next time by using the following flag:

  gcloud init --skip-diagnostics

 

Network diagnostic detects and fixes local network connection issues.

Checking network connection...done.

ERROR: Reachability Check failed.

    Cannot reach https://www.google.com (ServerNotFoundError)

    Cannot reach https://accounts.google.com (ServerNotFoundError)

    Cannot reach https://cloudresourcemanager.googleapis.com/v1beta1/projects (ServerNotFoundError)

    Cannot reach https://www.googleapis.com/auth/cloud-platform (ServerNotFoundError)

    Cannot reach https://dl.google.com/dl/cloudsdk/channels/rapid/components-2.json (ServerNotFoundError)

Network connection problems may be due to proxy or firewall settings.

 

如果需要代理選擇Y,或者N

Do you have a network proxy you would like to set in gcloud (Y/n)?  y

 

Select the proxy type:

 [1] HTTP

 [2] HTTP_NO_TUNNEL

 [3] SOCKS4

 [4] SOCKS5

Please enter your numeric choice:  2

 

Enter the proxy host address: 你的代理地址

 

Enter the proxy port: 3128

 

Is your proxy authenticated (y/N)?  n

 

Cloud SDK proxy properties set.

 

Rechecking network connection...done.

ERROR: Reachability Check still does not pass.

    Cannot reach https://www.google.com (HTTPError)

 

Current effective Cloud SDK network proxy settings:

    type = http_no_tunnel

    host = test.com

    port = 3128

    username = None

    password = None

 

配置GCP環境

設置GCP的項目

PS C:\Users\>  gcloud config set test-project

設置GCP的地區

PS C:\Users\> gcloud config set compute/region asia-east2

Updated property [compute/region].

 

設置GCPzone

PS C:\Users\> gcloud config set compute/zone asia-east2-a

 

登陸你的GCP

PS C:\Users\> gcloud auth  [email protected]

 

4.查看配置文件

PS C:\Users\> gcloud config list

[compute]

region = asia-east2

zone = asia-east2-a

[core]

account =   [email protected]

disable_usage_reporting = True

project = test-project

[proxy]

address = test.com

port = 3128

type = http_no_tunnel

 

Your active configuration is: [test-project]

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章