简体   繁体   English

在GCP中,如何列出项目下运行的所有资源?

[英]In GCP, how to list all the resources running under project?

I need to list out all the instance, container, function, notebooks, bucket, dataproc and composer running under project in all the region/locations.我需要列出在所有区域/位置的项目下运行的所有实例、容器、function、笔记本、存储桶、dataproc 和 composer。

Is it possible to list resources of all the regions location.是否可以列出所有区域位置的资源。 Gcloud or python script both can work for me Gcloud 或 python 脚本都可以为我工作

My ultimate goal after listing is to put tag as per its name of the resource.列出后我的最终目标是根据资源名称放置标签。

Thanks谢谢

If you want to access through console, you could go to IAM & Admin Menu , then select Asset Inventory .如果你想通过控制台访问,你可以 go 到IAM & Admin Menu ,然后 select Asset Inventory Then you could see bunch of asset list.然后你可以看到一堆资产列表。

GCP 控制台

Click Resource tab if you want download all the details in csv format.如果您想下载 csv 格式的所有详细信息,请单击“ Resource ”选项卡。

You can use Google Asset inventory feature and query your project like this您可以使用Google Asset 库存功能并像这样查询您的项目

gcloud asset search-all-resources --scope=projects/<PROJECT_ID>  --page-size=500 --format=json

More detail in the documentation about the query format.有关查询格式的文档中的更多详细信息。

All the ressources aren't supported.不支持所有资源。 You can find the full list here (For example, Cloud Run isn't yet supported, but it's coming soon!)您可以在此处找到完整列表(例如,尚不支持 Cloud Run,但即将推出!)

In search asset you will get abundance of irrelevant data.在搜索资产中,您将获得大量不相关的数据。 Better to use resource api of the resource you think relevant to you.最好使用您认为与您相关的资源的资源 api。 Like喜欢

compute.googleapis.com/Instance
storage.googleapis.com/Bucket
dataproc.googleapis.com/Cluster
container.googleapis.com/Cluster
cloudfunctions.googleapis.com/CloudFunction
dataflow.googleapis.com/Job     //Notebook


gcloud asset search-all-resources --asset-types='compute.googleapis.com/Instance,storage.googleapis.com/Bucket' --query='labels.name:*' --format='table(name, assetType, labels)'”

GCP has introduced the CLI to extract details of all resources in the project. GCP 引入了 CLI 来提取项目中所有资源的详细信息。 You can further customize this to get details from all projects in the organization.您可以进一步自定义它以获取组织中所有项目的详细信息。

https://cloud.google.com/sdk/gcloud/reference/asset/search-all-resources https://cloud.google.com/sdk/gcloud/reference/asset/search-all-resources

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何列出/获取项目中所有 GCP 资源的“创建者”? - How to list/get the 'creator' of all GCP resource in a project? 使用 Google Cloud Platform SDK CLI 列出给定项目下的所有活动资源 - Using the Google Cloud Platform SDK CLI to List all Active Resources Under a Given Project 从 GCP 获取所有项目所有者的列表 - Getting a list of all project owners from GCP 如何找到 GCP su.net 中存在的所有资源? - How to find all resources that exists inside a GCP subnet? 按位置限制对 GCP 组织和项目资源的访问 - Restrict access to GCP organisation and project resources by location GCP gcloud 脚本,用于将所有项目角色与文件中的角色列表进行比较 - GCP gcloud script to compare all project roles with a list of roles in a file 如何引用terraform中的GCP资源? - how to refer GCP resources in terraform? 控制点 | 如何查看项目中所有正在运行的虚拟机? - GCP | How I can see all the working virtual machines on a project? 如何获取在一个服务帐户下分配的多个 GCP 项目的列表? ( GCP )( python 客户端库文件) - How can get list of multiple - GCP projects assigned under one service account ? ( GCP )( python-client library files) 如何在 GCP 中列出包含给定权限的所有 IAM 角色 - How to list all the IAM roles that include a given permission in GCP
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM