forked from tsypuk/multicloud-diagrams
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
187 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
--- | ||
layout: default | ||
title: Elastic Compute Cloud | ||
parent: AWS Components | ||
nav_order: 3 | ||
date: 2023-10-24 | ||
--- | ||
|
||
# Elastic Compute Cloud | ||
{: .d-inline-block .no_toc } | ||
|
||
New (v0.3.17) | ||
{: .label .label-green } | ||
|
||
## Table of contents | ||
{: .no_toc .text-delta } | ||
|
||
1. TOC | ||
{:toc} | ||
|
||
--- | ||
|
||
|
||
## Node Type: ``ec2`` | ||
|
||
## Rendering: | ||
|
||
![lambda](output/jpg/ec2.jpg) | ||
|
||
## Code Snippet: | ||
|
||
```python | ||
{% root_include_snippet ../tests/aws/test_ec2.py %} | ||
``` | ||
|
||
## drawio ec2 vertex: | ||
|
||
```xml | ||
<mxCell id="vertex:ec2:arn:i-1234567890abcdef0" parent="1" vertex="1"> | ||
<mxGeometry width="78" height="78" as="geometry"/> | ||
</mxCell> | ||
``` | ||
--- | ||
|
||
## Advanced for Geeks: | ||
|
||
### Style: | ||
```html | ||
style="sketch=0;outlineConnect=0;fontColor=#232F3E;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 | | ||
|fontColor| #232F3E | | ||
|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: | ||
```xml | ||
<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;fontColor=#232F3E;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``: | ||
|
||
[Download](output/drawio/ec2.drawio){: .btn .btn-purple } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<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;fontColor=#232F3E;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> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
from multicloud_diagrams import MultiCloudDiagrams | ||
from utils.templating import TestRendering | ||
|
||
|
||
class TestAWSVertexInIsolation(TestRendering): | ||
|
||
def test_ec2(self): | ||
# docs | ||
self.node_type = 'ec2' | ||
|
||
# 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) | ||
|
||
# then | ||
expected = {'id': 'vertex:ec2:arn:i-1234567890abcdef0', | ||
'parent': '1', | ||
'style': 'sketch=0;outlineConnect=0;fontColor=#232F3E;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;', | ||
'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', | ||
'vertex': '1'} | ||
self.verify_resource(expected, mcd.mx_file, 'Client Certificate', self.node_type) | ||
|
||
# docs | ||
self.mcd = mcd |