AWS Administrator 也砍不掉的「specified resource」

2018-06-18 AWS

最近有一個 AWS Account Owner 來找我求救,說他們有一個 VPC 裡面的 ENI (Elastic Network Interfaces) 怎麼也砍不掉,然後當初的管理者也離職了,目前這個帳號的 Owner 也不是很清楚到底當初建了什麼資源,只知道這個 VPC 內的全部資源當初是測試用的要砍掉 …

 

好吧,既然已經確定該 VPC 資源都是可以砍掉的,那麼就來大肆破壞了 …

 

首先該 VPC 只剩兩張 ENI 並且不同 AZ,看起來是 Multi AZ 的資源,常試著 Detach + Force detachment 後出現訊息「You do not have permission to access the specified resource.」….

 

然後再看該張 ENI 有 Attach 一張 Security Group,嘗試砍這張 Security Group 也是「You do not have permission to access the specified resource.」….

 

不死心再把該張 ENI 的 Security Group 換成 default 的,結果也是「You do not have permission to access the specified resource.」….

 

好一個 specified resource … 連 Administrator 都砍不了你,難不成要 root 嗎 …

 

這時候只好抓去餵狗

 

很快第一篇就出現解答「Cant detach Network Interface due to permissions」裡面官方有提到可能是因為 Elastic Beanstalk 建立的時候一起帶出來的 ENI,所以因為相依性而無法砍 ENI

When you create an Elastic Beanstalk environment, it automatically creates security groups for you.

If outside of Beanstalk those security groups get attached to other resources, then your Beanstalk environment cannot be terminated because to do so would delete the security group(s) that are in use elsewhere.

To untangle the situation, refer to the notifications coming from the environment when you attempt your rebuild. It will list the security groups that are being referenced elsewhere.

 

但是!這個 Account 根本沒有建 Elastic Beanstalk … 然後去翻 CloudTrail 可能因為太久了 Online 記錄查不到,在不想去翻 Offline CloudTrail Log 的狀況下再動一下腦 … AWS 與 Elastic Beanstalk 相同性質的集合式服務還不少,可以朝這個方向思考。

 

最後是由同事協助找到是「Simple Active Directory」建起來的 ENI,由於該服務也是 EC2,所以也會把 ENI 帶起來 …

 

最後把 Simple Active Directory 砍掉就乾淨了 …

 

 

 

 

One Reply to “AWS Administrator 也砍不掉的「specified resource」”

  1. Rico表示:

    我也遇到類似的問題
    餵狗之後就找到你的文章了
    感謝

給 Mr. 沙先生一點建議

彙整

分類

展開全部 | 收合全部

License

訂閱 Mr. 沙先生 的文章

輸入你的 email 用於訂閱