Cara Install Google Cloud SDK. Cara Asyik Login dan Manager Cloud di GCP (Google Cloud Platform)

Ada banyak cara lho untuk akses dan login ke Cloud kamu di Google Cloud Platform (GCP). Kamu bisa menggunakan cara antara lain:

  • Via SSH/Keys
  • Browser support
  • Google Cloud SDK


Nah kali ini ayies akan kasih tau cara akses dan manage menggunakan Google Cloud SDK command yang asyik buat dicoba. Pada praktik kali ini ayies menggunakan Ubuntu, tapi ayies akan jelaskan juga cara install google cloud sdk di linux RPM based (centos dkk) yang intinya kurang lebih sama.

Ubuntu/Debian Based, Jalankan Perintah ini

# Create environment variable for correct distribution
export CLOUD_SDK_REPO="cloud-sdk-$(lsb_release -c -s)"

# Add the Cloud SDK distribution URI as a package source
echo "deb http://packages.cloud.google.com/apt $CLOUD_SDK_REPO main" | sudo tee -a /etc/apt/sources.list.d/google-cloud-sdk.list

# Import the Google Cloud Platform public key
curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -

# Update the package list and install the Cloud SDK
sudo apt-get update && sudo apt-get install google-cloud-sdk
gcloud init
  1. To continue, you must log in. Would you like to log in (Y/n)? Y
    
  2. Akan muncul browser atau permintaan untuk koneksi ke akun google cloud kamu. Silahkan diproses saja.
  3. Akan muncul beberapa pertanyaan. Jawab saja sesuai kebutuhan kamu.
    Which compute zone would you like to use as project default?
     [1] [asia-east1-a]
     [2] [asia-east1-b]
     ...
     [14] Do not use default zone
     Please enter your numeric choice:
gcloud has now been configured!
You can use [gcloud config] to change more gcloud settings.

Your active configuration is: [default]

Centos/Redhat Based, Jalankan Perintah ini

# Update YUM with Cloud SDK repo information:
sudo tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
[google-cloud-sdk]
name=Google Cloud SDK
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
       https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOM

# The indentation for the 2nd line of gpgkey is important.

# Install the Cloud SDK
yum install google-cloud-sdk
gcloud init
  1. To continue, you must log in. Would you like to log in (Y/n)? Y
    
  2. Akan muncul browser atau permintaan untuk koneksi ke akun google cloud kamu. Silahkan diproses saja.
  3. Akan muncul beberapa pertanyaan. Jawab saja sesuai kebutuhan kamu.
    Which compute zone would you like to use as project default?
     [1] [asia-east1-a]
     [2] [asia-east1-b]
     ...
     [14] Do not use default zone
     Please enter your numeric choice:
gcloud has now been configured!
You can use [gcloud config] to change more gcloud settings.

Your active configuration is: [default]

Mulai login ke Server/Cloud mu!

Nah, setelah proses tersebut lalu bagaimana cara login ke server cloud kita? Cara sederhana-nya kita cukup copy paster command dari GCP console:

 

Buk terminal dan paste command.

Cara Install Google Cloud SDK. Cara Asyik Login dan Manager Cloud di GCP

Selamat kamu berhasil!

Buat kamu yang belum punya server cloud google silahkan register langsung ajah digoogle. Dapat kredit $300 lho gratis! Disini