gcp雷包之compute engine default service account不要亂刪

sasa :)
Jun 16, 2021

--

#gcp雷包 #ComputeEngineDefaultSerivceAccount

在GCP中,有些服務,Google會給他一個特定的service account[1]

這是Google幫你管的

其中一種,叫做 Compute Engine default service account [2]

這個service account格式長得像這樣:

PROJECT_NUMBER-compute@developer.gserviceaccount.com

在IAM裡面,每個專案通常在create出來時,

你就會看到這個了

就是for Compute Engine用的,而且權限很大,會直接給 Editor

有些 比較有sense 的使用者(XD),會覺得不安全,因此有兩種做法:

  1. Editor 權限拿掉,只留符合最小權限原則的。例如:Storage Object Creator這樣。
  2. 直接create一個service account for該vm(or service)專門使用。

這兩種做法,都很好,沒有對錯。

不過如果選擇第二個權限的人,有可能會想說,那我就用不到compute default service account,不然我就通通把權限移除吧~

這時候雷包就會出現了。

當你發現你用不到,想要移除compute engine default service account所有的權限的時候

都不會有問題

問題會出現在你突然要用的時候。

文件[2]中有提到:

You can disable or delete this service account from your project, but doing so might cause any applications that depend on the service account’s credentials to fail. If you accidentally delete the Compute Engine default service account, you can try to recover the account within 30 days

簡單說就是,你要刪就刪,但如果不小心用到compute engine default service account時,就有可能會壞掉。

這裡的不小心,有可能會是從market place直接起服務的時候啊等等的…

有些已經包好的service,就是會寫死compute engine default service account啊啊啊啊啊啊…

最雷的地方是

當你刪除compute engine default service account權限時,30天內是可以抓回來的。

當超過30天,但又想要再把這東西找回來時,是 找 不 回 來

只能create new project惹~~~~~~

以上

有問題歡迎提出討論唷~ :)

--

--

sasa :)
sasa :)

Written by sasa :)

目標是做一個讓所有人都聽得懂技術語言的transfer person

No responses yet