且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

从cloudformation模板绘制图像

更新时间:2023-11-10 13:01:46

您可以使用最新版本的



对应于thi s模板:

  {
AWSTemplateFormatVersion: 2010-09-09,
说明:演示Fn :: GetAtt的示例模板,
资源:{
DetectTextInImage:{
Type: AWS :: Lambda :: Function,
属性:{
角色:{
Fn :: GetAtt:[
DetectTextInImageRole,
Arn
]
}
}
},
DetectTextInImageBucketEvent1Permission:{
Type: AWS :: Lambda :: Permission,
Properties: {}
},
DetectTextInImageRole:{
Type: AWS :: IAM :: Role,
属性:{}
} ,
ResultsTable:{
Type: AWS :: DynamoDB :: Table,
Properties:{}
},
SourceImageBucket :{
类型: AWS :: S3 :: Bucket,
属性:{
NotificationConfiguration:{
LambdaConfiguration s:[
{
Function:{
Fn :: GetAtt:[
DetectTextInImage,
Arn
]
}
}
]
}
}
}
}
}


Is the any drawing / export tool that I can use to turn a cloudformation template into a diagram.

In need to export my cloudformation stack into an image, or a graphviz file.

Regards,

You can use the latest version of the cfn-lint tool to get a graph of resources from your template.

Use it like this:

pip3 install cfn-lint pydot
cfn-lint template.json -g

For example, it will generate a DOT file that renders like this:

Which corresponds to this template:

{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Description": "Sample template that demonstrates Fn::GetAtt",
  "Resources": {
    "DetectTextInImage": {
      "Type": "AWS::Lambda::Function",
      "Properties": {
        "Role": {
          "Fn::GetAtt": [
            "DetectTextInImageRole",
            "Arn"
          ]
        }
      }
    },
    "DetectTextInImageBucketEvent1Permission": {
      "Type": "AWS::Lambda::Permission",
      "Properties": {}
    },
    "DetectTextInImageRole": {
      "Type": "AWS::IAM::Role",
      "Properties": {}
    },
    "ResultsTable": {
      "Type": "AWS::DynamoDB::Table",
      "Properties": {}
    },
    "SourceImageBucket": {
      "Type": "AWS::S3::Bucket",
      "Properties": {
        "NotificationConfiguration": {
          "LambdaConfigurations": [
            {
              "Function": {
                "Fn::GetAtt": [
                  "DetectTextInImage",
                  "Arn"
                ]
              }
            }
          ]
        }
      }
    }
  }
}