pistazie / cdk-dia

Automated diagrams of CDK provisioned infrastructure
MIT License
896 stars 38 forks source link

Add an AWS EC2 Security Group Icon #3

Open pistazie opened 3 years ago

pistazie commented 3 years ago

cdk-dia currently has no icon for a security group.

the following cdk App:

import * as cdk from '@aws-cdk/core';
import * as ec2 from '@aws-cdk/aws-ec2';

export class SoTsStack extends cdk.Stack {
  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const vpc = new ec2.Vpc(this, 'vpc')

    const sg = new ec2.SecurityGroup(this,'sg',{
      vpc: vpc
    })

    new ec2.Instance(this,'instance',{
      instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MEDIUM),
      vpc: vpc,
      machineImage: ec2.MachineImage.latestAmazonLinux(),
      securityGroup: sg
    })
  }
}

yields the following diagram: diagram Which misses a security group icons.

The icons mapping is at src/diagram/aws/awsResouceIconMatches.json

All current CDK icons are taken from https://aws.amazon.com/architecture/icons/

One has to figure out whether AWS has such an icon or how to come up with an icon that is descriptive and also consistent with current AWS/CDK-Dia icons.

udondan commented 3 years ago

The image seem to be gone from the current set. There was one included when they used to be called "AWS Simple Icons". There is a low quality version preserved at Wikimedia: https://commons.wikimedia.org/wiki/File:AWS_Simple_Icons_Groups_Security_Group.svg

Though the image was not meant to be used as an icon. More like a container, like VPC, AZs and regions.

SrHTd

I wonder if it would be feasible to display these group resources in such a way.

pistazie commented 3 years ago

CDK-Dia currently renders using Graphviz It should be possible to style border there. The diagrming logic currently looks at a Security group as a resource and not as clustering object which contains other objects.

I see the advantages of such an approach (could be well used with #4) but also see that is creates rather networking-focused diagrams.

Not sure where to take in from here :)