awslabs / diagram-as-code

Diagram-as-code for AWS architecture.
Apache License 2.0
406 stars 23 forks source link

First steps to generate diagrams from CloudFormation templates #49

Closed a2ush closed 1 month ago

a2ush commented 1 month ago

Issue #, if available:

related to #9

Description of changes:

This PR does not resolve issue #9 completely. However, it would be a first step towards achieving this goal.

Test

$ aws test-cloudformation-template.yaml --cfn-template

output

test-cloudformation-template.yaml

Resources:
  VPC:
    Type: AWS::EC2::VPC
    Properties:
      EnableDnsSupport: true
      EnableDnsHostnames: true

  Subnet1:
    Type: AWS::EC2::Subnet
    Properties:
      VpcId: !Ref VPC
      AvailabilityZone: !Ref AvailabilityZone1
      CidrBlock: !Ref Subnet1CIDER
      MapPublicIpOnLaunch: false

  Subnet2:
    Type: AWS::EC2::Subnet
    Properties:
      VpcId: !Ref VPC
      AvailabilityZone: !Ref AvailabilityZone1
      CidrBlock: !Ref Subnet1CIDER    
      MapPublicIpOnLaunch: false

  EC2Instance1:
   Type: "AWS::EC2::Instance"
   Properties:
     InstanceType: "t3.small"
     NetworkInterfaces:
     - AssociatePublicIpAddress: true
       DeviceIndex: "0"
       SubnetId: !Ref Subnet1

  EC2Instance2:
   Type: "AWS::EC2::Instance"
   Properties:
     InstanceType: "t3.small"
     NetworkInterfaces:
     - AssociatePublicIpAddress: true
       DeviceIndex: "0"
       SubnetId: !Ref Subnet1

  EC2Instance3:
   Type: "AWS::EC2::Instance"
   Properties:
     InstanceType: "t3.small"
     NetworkInterfaces:
     - AssociatePublicIpAddress: true
       DeviceIndex: "0"
       SubnetId: !Ref Subnet2

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.