Drawing an image from a cloudformation template

╄→尐↘猪︶ㄣ 提交于 2020-04-06 19:24:07

问题


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,


回答1:


You can use the AWS CloudFormation designer. Click on Open, then upload your template. Finally take a screenshot of the result to have it in an image format.

Here's an exemple of what the result might look like:

For more information, have a look at the doc.




回答2:


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"
                ]
              }
            }
          ]
        }
      }
    }
  }
}


来源:https://stackoverflow.com/questions/48102947/drawing-an-image-from-a-cloudformation-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!