Pythontr

husonet | Tarih: 17.09.2019

gcloud command-line tool nedir?

Bu yazımız gcloud command-line tool kurulumu ve kullanımı hakkında notlar içerir

gcloud command-line tool nedir?

Gcloud command-line tool, komut satırı üzerinden Google Cloud Platform’u yönetmemizi sağlayan bir araçtır.


Örneğin bu toolu aşağıdaki kaynakları yönetmek için kullanabilirsiniz;
  • Google Compute Engine sanal makine örnekleri ve diğer kaynaklar
  • Google Cloud SQL örnekleri
  • Google Kubernetes Engine clusters
  • Google Cloud Dataproc clusterlar ve joblar
  • Google Cloud DNS yönetilen bölgeler ve kayıt kümeleri
  • Google Cloud Deployment yöneticisi dağıtımları

gcloud command-line için sdk kurulumu

Kurulumumu mac üzerine yapacağım için https://cloud.google.com/sdk/docs/quickstart-macos bu sayfadan sdk'yı download yapacağım. Farklı işletim sistemi kullanan arkadaşlar bu sayfayı inceleyebilirler. https://cloud.google.com/sdk/install


indirdiğim dosya tar.gz uzantılı bir dosya olduğu için aşağıdaki şekilde dosyamızı açabilirsiniz.


tar xzvf xxx.tar.gz

Kurulum için aşağıdaki kodu çalıştırabiliriz;
./google-cloud-sdk/install.sh

Ardından yapılandırmayı aşağıdaki şekilde yapabiliriz;
gcloud init

Çıktımız aşağıdaki gibi olacaktır;
Welcome! This command will take you through the configuration of gcloud.

Your current configuration has been set to: [default]

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.
Reachability Check passed.
Network diagnostic passed (1/1 checks passed).

You must log in to continue. Would you like to log in (Y/n)?

Your browser has been opened to visit:

https://accounts.google.com/o/oauth2/auth?code_challenge=xxxxxxx


You are logged in as: [huseyin[@]pythontr.com].

Pick cloud project to use:
[1] pythontrcom-151712
[2] Create a new project
Please enter numeric choice or text value (must exactly match list
item): 1

Your current project has been set to: [pythontrcom-151712].
..........

Kullanabileceğimiz konsol komutları;
gcloud compute instances list

Projeleri listelemek için
gcloud projects list

Dosya listeleme
gsutil ls gs://pythontr-staging

Dosya kopyalama
touch /tmp/test
gsutil cp /tmp/test gs://pythontr-staging
Copying file:///tmp/test [Content-Type=application/octet-stream]...
/ [1 files][ 0.0 B/ 0.0 B]
Operation completed over 1 objects.

Daha fazla bilgi
gsutil help