Created: 2023-10-24 | Updated: 2024-08-11
Elastic Compute Cloud
New (v0.3.17)
Table of contents
Node Type: ec2
Rendering:
Code Snippet:
# given
mcd = MultiCloudDiagrams()
# when
ec2_arn = 'arn:i-1234567890abcdef0'
ec2_name = 'Test Instance'
metadata = {
"AmiLaunchIndex": 0,
"ImageId": "ami-0abcdef1234567890",
"InstanceId": "i-1234567890abcdef0",
"InstanceType": "t3.nano",
"KeyName": "my-key-pair",
"LaunchTime": "2022-11-15T10:48:59+00:00",
"Monitoring": {
"State": "disabled"
},
"Placement": {
"AvailabilityZone": "us-east-2a",
"GroupName": "",
"Tenancy": "default"
},
"PrivateDnsName": "ip-10-0-0-157.us-east-2.compute.internal",
"PrivateIpAddress": "10-0-0-157",
"ProductCodes": [],
"PublicDnsName": "ec2-34-253-223-13.us-east-2.compute.amazonaws.com",
"PublicIpAddress": "34.253.223.13",
"SubnetId": "subnet-04a636d18e83cfacb",
"VpcId": "vpc-1234567890abcdef0",
"Architecture": "x86_64",
"Hypervisor": "xen"
}
mcd.add_vertex(node_id=ec2_arn, node_name=ec2_name, node_type='ec2', metadata=metadata)
drawio ec2 vertex:
<mxCell id="vertex:ec2:arn:i-1234567890abcdef0" parent="1" vertex="1">
<mxGeometry width="78" height="78" as="geometry"/>
</mxCell>
Advanced for Geeks:
Style:
style="sketch=0;outlineConnect=0;gradientColor=#F78E04;gradientDirection=north;fillColor=#D05C17;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.ec2;"
attribute | value |
---|---|
align | left |
aspect | fixed |
dashed | 0 |
fillColor | #D05C17 |
fontSize | 12 |
fontStyle | 0 |
gradientColor | #F78E04 |
gradientDirection | north |
html | 1 |
outlineConnect | 0 |
resIcon | mxgraph.aws4.ec2 |
shape | mxgraph.aws4.resourceIcon |
sketch | 0 |
strokeColor | #ffffff |
verticalAlign | top |
verticalLabelPosition | bottom |
Vertex size:
attribute | value |
---|---|
width | 78 |
height | 78 |
Full XML dump:
<mxfile host="multicloud-diagrams" agent="PIP package multicloud-diagrams. Generate resources in draw.io compatible format for Cloud infrastructure. Copyrights @ Roman Tsypuk 2023. MIT license." type="MultiCloud">
<diagram id="diagram_1" name="AWS components">
<mxGraphModel dx="1015" dy="661" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="850" pageHeight="1100" math="0" shadow="1">
<root>
<mxCell id="0"/>
<mxCell id="1" parent="0"/>
<mxCell id="vertex:ec2:arn:i-1234567890abcdef0" value="<b>Name</b>: Test Instance<BR><b>ARN</b>: arn:i-1234567890abcdef0<BR>-----------<BR><b>AmiLaunchIndex</b>: 0<BR><b>ImageId</b>: ami-0abcdef1234567890<BR><b>InstanceId</b>: i-1234567890abcdef0<BR><b>InstanceType</b>: t3.nano<BR><b>KeyName</b>: my-key-pair<BR><b>LaunchTime</b>: 2022-11-15T10:48:59+00:00<BR><b>Monitoring</b>: {'State': 'disabled'}<BR><b>Placement</b>: {'AvailabilityZone': 'us-east-2a', 'GroupName': '', 'Tenancy': 'default'}<BR><b>PrivateDnsName</b>: ip-10-0-0-157.us-east-2.compute.internal<BR><b>PrivateIpAddress</b>: 10-0-0-157<BR><b>ProductCodes</b>: []<BR><b>PublicDnsName</b>: ec2-34-253-223-13.us-east-2.compute.amazonaws.com<BR><b>PublicIpAddress</b>: 34.253.223.13<BR><b>SubnetId</b>: subnet-04a636d18e83cfacb<BR><b>VpcId</b>: vpc-1234567890abcdef0<BR><b>Architecture</b>: x86_64<BR><b>Hypervisor</b>: xen" style="sketch=0;outlineConnect=0;gradientColor=#F78E04;gradientDirection=north;fillColor=#D05C17;strokeColor=#ffffff;dashed=0;verticalLabelPosition=bottom;verticalAlign=top;align=left;html=1;fontSize=12;fontStyle=0;aspect=fixed;shape=mxgraph.aws4.resourceIcon;resIcon=mxgraph.aws4.ec2;" parent="1" vertex="1">
<mxGeometry width="78" height="78" as="geometry"/>
</mxCell>
</root>
</mxGraphModel>
</diagram>
</mxfile>
drawio file:
Download generated ec2.drawio
: