求助:无法在GCP上禁用Compute Engine和Notebooks API
无法禁用GCP Compute Engine/Notebooks API的解决思路
问题背景
尝试通过API服务界面及命令行禁用Compute Engine和Notebooks API均失败:
- 命令行执行:
gcloud services disable compute.googleapis.com --force - 已删除Compute Engine、Notebooks下所有可见资源
- API界面操作时出现错误(常见为依赖服务未停用或残留资源存在)
解决步骤
检查依赖服务
Compute Engine API被大量其他GCP服务依赖(如Cloud Functions、VPC服务等),先列出并禁用这些依赖服务:gcloud services list --enabled --filter="consumerId:projects/[你的项目ID] AND parentService:compute.googleapis.com"清理完依赖后再尝试禁用目标API。
排查隐藏残留资源
控制台未显示的资源可能导致禁用失败,用以下命令逐一排查删除:# 静态IP地址 gcloud compute addresses list # 磁盘快照、镜像 gcloud compute snapshots list gcloud compute images list # 实例模板、实例组 gcloud compute instance-templates list gcloud compute instance-groups list # Notebooks残留资源 gcloud notebooks instances list gcloud notebooks environments list # 网络规则 gcloud compute firewall-rules list gcloud compute routes list检查组织政策限制
若项目属于企业组织,可能存在组织政策强制启用Compute Engine API。进入IAM & Admin -> 组织政策,搜索相关规则(如compute.enabled),确认是否有强制启用的配置。进阶强制禁用命令
尝试后台异步执行禁用命令,避免前台超时:# 禁用Compute Engine API gcloud services disable compute.googleapis.com --force --async # 禁用Notebooks API gcloud services disable notebooks.googleapis.com --force --async联系官方支持
若以上操作均无效,大概率是平台内部状态异常,提交GCP支持工单,提供项目ID和报错详情,让官方协助清理残留状态。
内容的提问来源于stack exchange,提问作者Bilal Mussa
相关产品推荐
相关产品推荐

