【问题标题】:How do I find which resources use a vpc in GCP?如何在 GCP 中找到哪些资源使用 vpc?
【发布时间】:2021-03-12 08:45:52
【问题描述】:

我想删除一个 GCP vpc,我得到:

Failed to delete the network. Error: Some of the resources are referenced by other existing resources and cannot be deleted.

我如何确定这些other existing resources 是什么?

【问题讨论】:

    标签: google-cloud-platform google-vpc


    【解决方案1】:

    可以使用 VPC 网络的资源如下:

    • 子网
    • 静态内部 IP 地址
    • 防火墙规则
    • 路由(包括静态和自动/动态创建的路由)
    • VPC 网络对等
    • 私人服务连接
    • 实例

    唯一的方法是手动检查每个类别并确保没有使用 VPC。

    有关每种资源的更多信息,请访问此文档 [1]。

    干杯!


    [1]https://cloud.google.com/vpc/docs/vpc#specifications

    【讨论】:

    • 谢谢!您找到说明这一点的文件了吗?
    • 是的,我的回复中提供的信息是对当前文档的摘要。我已经对其进行了编辑以添加链接。
    【解决方案2】:

    GCP中有很多resources that relate directly to a VPC NW

    列出它们的两个选项:

    1. 您可以列出他们directly with the API
    2. 您可以使用this python script 列出其中的大部分。我的猜测是你会在这里找到阻止你删除 NW 的资源。 输出如下所示:
    
    --------------------------------------------
    Subnetworks in Network alon-test-network:
    --------------------------------------------
    https://www.googleapis.com/compute/v1/projects/alon-lavian/regions/us-central1/subnetworks/alon-test-network
    https://www.googleapis.com/compute/v1/projects/alon-lavian/regions/asia-east1/subnetworks/subnet-2
    
    --------------------------------------------
    Instances in VPC alon-test-network:
    --------------------------------------------
    instance-3, zone: us-central1-a
    
    --------------------------------------------
    FW rules in Network alon-test-network:
    --------------------------------------------
    alon-test-network-allow-custom
    alon-test-network-allow-http
    alon-test-network-allow-https
    alon-test-network-allow-icmp
    default-allow-ssh-alon
    
    --------------------------------------------
    Routes in Network alon-test-network:
    --------------------------------------------
    default-route-d957345c6aef02c8 destination range: 10.128.0.0/20
    default-route-dcecf66e898091c4 destination range: 10.0.0.0/9
    default-route-fa59cdb8270a46ab destination range: 0.0.0.0/0
    
    --------------------------------------------
    VPN GW in Network alon-test-network:
    --------------------------------------------
    alon-vpn
    
    --------------------------------------------
    Routers in Network alon-test-network:
    --------------------------------------------
    
    --------------------------------------------
    Addresses in Network alon-test-network:
    --------------------------------------------
    alon-address ,users: ['https://www.googleapis.com/compute/v1/projects/alon-lavian/zones/us-central1-a/instances/instance-3']
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-03-18
      • 1970-01-01
      • 1970-01-01
      • 2019-02-16
      • 2016-11-23
      • 2021-02-22
      相关资源
      最近更新 更多