Skip to content

Instantly share code, notes, and snippets.

View SanthoshNC's full-sized avatar
🏠
Working from home

Santhosh NC SanthoshNC

🏠
Working from home
View GitHub Profile
from diagrams import Diagram, Cluster, Edge
from diagrams.custom import Custom
from diagrams.onprem.network import Nginx
from diagrams.onprem.network import Tomcat
from diagrams.onprem.inmemory import Memcached
from diagrams.onprem.queue import Rabbitmq
from diagrams.onprem.database import Mongodb
from diagrams.onprem.database import Mysql
from diagrams.elastic.elasticsearch import Elasticsearch
xdg-open my_diagram.jpg # Opens the generated diagram in default image viewver.
python3 2_advanced_diagram.py # To run the file to generate diagram
ls -lrt # To check the files. A file called my_diagram.jpg will be generated in the directory
from diagrams import Cluster, Diagram
from diagrams.aws.compute import ECS
from diagrams.aws.network import ELB, Route53
from diagrams.aws.database import RDS
from diagrams.onprem.client import User
graph_attr = {
"fontsize": "25",
"bgcolor": "transparent"
}
xdg-open simple_diagram.png # Opens the generated diagram in default image viewver.
python3 1_basic_diagram.py # To run the file to generate diagram
ls -lrt # To check the files. A file called simple_diagram.png will be generated in the directory
from diagrams import Diagram # importing diagram package
from diagrams.aws.compute import EC2 # importing AWS EC2 resource
with Diagram("Simple Diagram"): # "Simple Diagram" is the name of the diagram. The image will be stored as "simple_diagram.png"
EC2("web") # An icon of EC2 will be generated with the name "web"
# To install Diagrams
pip install diagrams
# To install Graphviz
choco install graphviz
# Install pip
sudo apt install python3-pip
# using pip (pip3)
pip install diagrams