Google Compute Engine
跳至導覽
跳至搜尋
Google Compute Engine是GCP的VM類服務。
範例
關閉GCE的自動建立帳號以及SSH key機制:
echo -e '[Daemons]\naccounts_daemon = false' | sudo tee /etc/default/instance_configs.cfg; sudo reboot
所有在staff群組的人都可以無限制sudo:
echo "%staff ALL = (ALL:ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/group-staff
安裝gcloud
指令:
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; curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/cloud.google.gpg > /dev/null; sudo apt update; sudo apt install -y google-cloud-cli; sudo apt clean
安裝gce2env
,這隻程式可以把Google Secret Manager裡面的dotenv資料轉到環境變數裡,再執行我們的程式:
sudo curl -L -o /usr/sbin/gsm2env https://gist.github.com/gslin/ec0c2df038732246feb84f07cbb20a66/raw/6e4f5afdfe236e507815d61d4e23f601597f5560/gsm2env; sudo chmod 755 /usr/sbin/gsm2env