Skip to main content

用于可视化 AWS CloudFormation 导入/导出和显示依赖关系图的工具

项目描述

基础架构依赖可视化

Python 包

此工具正在查看 CloudFormation 导出/导入并将它们可视化。它还可以基于附加在相关 CloudFormation 标签上的标签在更高级别抽象和分组依赖项。

在其默认配置中,它正在寻找 tags ServiceName/ServiceComponentName/Component并期望一个堆栈命名方案,如下所示:

reco-dev-storeloader-task-rfystorage
<project>-<env>-<component_name>

如果您想在其他帐户中应用它,这些东西可以更改并且需要更改。

此工具还查找不在目标 AWS 账户中的上游外部依赖项。它通过查找嵌入了元数据的 CloudFormation 参数描述来做到这一点。下面是一个例子:

Parameters:
  ...
  SnowflakeAccount:
    Type: String
    Description: "The snowflake account name which is used to connect to. | team=Data,service=Snowflake"

output它在文件夹中生成 GraphViz 输出。有关堆栈的其他额外有趣的信息显示在标准输出中,并且也导出为 JSON。

安装

如果您不想克隆 repo,也可以通过 Pypi 安装此工具。我建议使用 pipx 而不是 pip 以免弄乱您的本地 python 环境:

pip install aws-infra-graph
pipx install aws-infra-graph

配置

如果您有外部下游依赖项,请根据您的服务重命名并config.hocon.template调整。config.hocon名称需要与发现的服务名称相匹配。此外,还可以指定内部手动依赖项,例如手动创建基础架构组件。在配置中,还可以配置为哪些 CloudFormation 标签完成更高级别的分组。除了在当前文件夹中有配置,您还可以使用infra-graph init~/.config/aws-infra-graph/config.hocon

如何执行

如果您克隆了源,则需要以下内容:

brew install graphviz # depends on the availability of the dot tool
poetry install
poetry shell

以下命令现在可以在您的诗歌 venv 中使用,或者如果您之前通过 pip/pipx 安装了该软件。

infra-graph --help
infra-graph init
infra-graph export
open output/

从 AWS 收集数据等繁重的操作被缓存到磁盘。如果您想重新收集数据,请添加--refresh标志。

用法

Usage: infra-graph [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  export  Gather data about the infra and visualize them
  init    Initialize config after installation
Usage: infra-graph export [OPTIONS]

  Gather data about the infra and visualize them

Options:
  -e, --env TEXT             On which environment to run this task. e.g. dev,
                             stg, prd  [default: dev]

  -t, --project-name TEXT    Project/Team name is expected of part of the
                             resource name and need to be specified here or
                             taken from config

  -r, --refresh              In case of disc cached result clear them
                             beforehand

  -c, --cluster-stack-graph  Should the results of the stack graph be
                             clustered by service?

  -o, --output-folder TEXT   To which folder to export the generated files
  --help                     Show this message and exit.

项目详情


下载文件

下载适用于您平台的文件。如果您不确定要选择哪个,请了解有关安装包的更多信息。

内置分布

aws_infra_graph-0.1.5-py3-none-any.whl (14.4 kB 查看哈希

已上传 py3