「Gcloud」:修訂間差異

出自Gea-Suan Lin's Wiki
跳至導覽 跳至搜尋
本頁面具有訪問限制。如果您看見此訊息,這代表您沒有訪問本頁面的權限。
(建立内容为“{{Lowercase}} '''gcloud'''是GCP的命令列工具。 == 連結 == * {{Official|https://cloud.google.com/sdk/gcloud}}”的新页面)
 
 
(未顯示同一使用者於中間所作的 11 次修訂)
行 1: 行 1:
{{Lowercase}}
{{Lowercase}}
'''gcloud'''是[[GCP]]的命令列工具。
'''gcloud'''是[[GCP]]的命令列工具。
== 安裝 ==
<syntaxhighlight lang="bash">
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/cloud.google.gpg > /dev/null; echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list; sudo apt update; sudo apt install -y google-cloud-cli
</syntaxhighlight>
== 範例 ==
=== Compute Engine ===
<syntaxhighlight lang="bash">
gcloud compute instances create test-by-gslin --zone=asia-east1-a --machine-type=e2-micro --image-project=ubuntu-os-cloud --image-family=ubuntu-2204-lts --tags=allow-whitelist-ssh --network=vpc-default --subnet=subnet-asia-east-1 --private-network-ip=ip-10-143-0-200 --address=eip-test-by-gslin --metadata-from-file ssh-keys=${HOME}/.ssh/example.pub
</syntaxhighlight>
<syntaxhighlight lang="bash">
gcloud compute ssh ubuntu@test-by-gslin --zone asia-east1-a --project myproject-123456 --ssh-key-file ~/.ssh/id_rsa
</syntaxhighlight>
=== Cloud Storage ===
<syntaxhighlight lang="bash">
gcloud storage buckets list --format=json
</syntaxhighlight>
=== DNS ===
<syntaxhighlight lang="bash">
gcloud dns record-sets transaction start --zone=example-net
gcloud dns record-sets transaction add 10.1.2.3 --name=foo.example.net --ttl=300 --type=A --zone=example-net
gcloud dns record-sets transaction execute --zone=example-net
</syntaxhighlight>


== 連結 ==
== 連結 ==


* {{Official|https://cloud.google.com/sdk/gcloud}}
* {{Official|https://cloud.google.com/sdk/gcloud}}

於 2023年10月30日 (一) 02:56 的最新修訂

gcloudGCP的命令列工具。

安裝

curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/cloud.google.gpg > /dev/null; echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list; sudo apt update; sudo apt install -y google-cloud-cli

範例

Compute Engine

gcloud compute instances create test-by-gslin --zone=asia-east1-a --machine-type=e2-micro --image-project=ubuntu-os-cloud --image-family=ubuntu-2204-lts --tags=allow-whitelist-ssh --network=vpc-default --subnet=subnet-asia-east-1 --private-network-ip=ip-10-143-0-200 --address=eip-test-by-gslin --metadata-from-file ssh-keys=${HOME}/.ssh/example.pub
gcloud compute ssh ubuntu@test-by-gslin --zone asia-east1-a --project myproject-123456 --ssh-key-file ~/.ssh/id_rsa

Cloud Storage

gcloud storage buckets list --format=json

DNS

gcloud dns record-sets transaction start --zone=example-net
gcloud dns record-sets transaction add 10.1.2.3 --name=foo.example.net --ttl=300 --type=A --zone=example-net
gcloud dns record-sets transaction execute --zone=example-net

連結