简体   繁体   English

无论资源类型如何,如何获取 AWS 账户中的所有资源

[英]how to get all the resources in an AWS account irrespective of the resource type

I want to get all the resources in an AWS account irrespective of the resource type and region using python.我想获取 AWS 账户中的所有资源,而不管使用 python 的资源类型和区域如何。 So that i can see how many resources were created, when created etc这样我就可以看到创建时创建了多少资源 etc

How can i achieve this.我怎样才能做到这一点。 I followed boto3 but i am unable to find a way to get all resources.我关注了 boto3,但我无法找到获取所有资源的方法。

I followed: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/resource-groups.html#ResourceGroups.Client.group_resources我跟着: https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/resource-groups.html#ResourceGroups.Client.group_resources

Am able to get all instance using one service, am able to get all s3 at one service.. but i need all resources at a time irespective of resion or type我能够使用一项服务获取所有实例,能够在一项服务中获取所有 s3 .. 但我一次需要所有资源,无论 resion 或类型如何

Please suggest me good way to achieve this at once.请建议我立即实现这一目标的好方法。

If not, is there a way where i can pass all resource type in a list and pass it and get.如果没有,有没有办法可以传递列表中的所有资源类型并传递并获取。

If you have enabled AWS Config service, you can easily list all your resources.如果您启用了 AWS Config 服务,您可以轻松列出所有资源。

list_discovered_resources : Only lists resources in the current account/region. list_discovered_resources :仅列出当前帐户/区域中的资源。 That means you need to create a client in each region and merge the results.这意味着您需要在每个区域中创建一个客户端并合并结果。

You can also configure multi-account multi-region data aggregation to fetch resources from all your accounts.您还可以配置多账户多区域数据聚合以从您的所有账户中获取资源。 In this case, you can simply use list_aggregate_discovered_resources and filter resources by account and region.在这种情况下,您可以简单地使用list_aggregate_discovered_resources并按帐户和区域过滤资源。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM