Making Cloud Drawings with Python

Alain Airom (Ayrom)
3 min readOct 30, 2023

My first experience in writing a sample code in Python to make cloud drawings!

Usually, when I intend to build professional drawings for my projects, I use ‘’ ( which I find a fantastic tool. It could be used either online or as a desktop application and the available shapes library is huge. All the major hyper scalers/cloud providers are available (AWS, Azure, GCP, and for sure the most important one for me, IBM)

Components Panel

So building a sketch like the following is done in under a minute!

But recently, I saw a post on a Python library; ‘Diagrams’ ( that generates diagrams by code!

The installation is quite straightforward;

# using pip (pip3)
$ pip install diagrams

# using pipenv
$ pipenv install diagrams

# using poetry
$ poetry add diagrams

You also need to install Graphviz to render the diagrams ( otherwise it won’t work. The documentation for ‘Diagrams’ is quite clear and some very nice samples are provided. Packages for making diagrams are provided for all major players.

It is also very easy to add custom icons/images to the existing sets (which I did for my test).

Once the installations are done, it is quite easy, even for me who is a novice Python coder. I was able to provide the following code in less than 30 minutes to make a basic diagram.

from diagrams import Diagram, Cluster
from diagrams.custom import Custom

from diagrams.k8s.infra import Master, Node

with Diagram("IBM Cloud Compute Services", show=False, filename="custom_local", direction="TB"):
ibm_cloud = Custom("IBM Cloud", "./my_resources/CloudTag.png")

with Cluster("Compute"):
with Cluster("Kubernetes Services"):
iks = Custom("IKS", "./my_resources/GeneralClusterTag.png")
k8s = Custom("k8s", "./my_resources/KubeClusterTag.png")
iks_classic = Custom("IKS Classic", "./my_resources/iks-classic.png")
iks_vpc = Custom("IKS VPC", "./my_resources/iks-vpc.png")
ocp = Custom("OpenShift", "./my_resources/OpenShiftClusterTag.png")
ocp_classic = Custom("OpenShift Classic", "./my_resources/ocp-classic.png")
ocp_vpc = Custom("OpenShift VPC", "./my_resources/ocp-vpc.png")
ocp_satellite = Custom("OpenShift Satelliet", "./my_resources/ocp-satellite.png")

with Cluster("Virtual Servers"):
vsi = Custom("Classic VSI", "./my_resources/ClassicTag.png")
vpc = Custom("VPC", "./my_resources/VPCTag.png")
vpcarch = Custom("VPC", "./my_resources/ibm_vpc_architecture_drawio.png")

with Cluster("Bare Metam"):
baremetal = Custom("Bare Metal", "./my_resources/BareMetalServerTag.png")

with Cluster("VMWare"):
vmware_svc = Custom("VMWare Services", "./my_resources/vmware-svc.png")
vmware = Custom("VMWare Services", "./my_resources/vmware.png")

with Cluster("Power"):
powervs = Custom("Power VS", "./my_resources/powervs.png")

with Cluster("Serverless"):
codeengine = Custom("Code Engine", "./my_resources/codeengine.png")

ibm_cloud >> iks >> k8s
k8s >> iks_classic
k8s >> iks_vpc
ibm_cloud >> ocp
ocp >> ocp_classic
ocp >> ocp_vpc
ocp >> ocp_satellite
ibm_cloud >> codeengine
ibm_cloud >> vmware_svc
vmware_svc >> vmware
ibm_cloud >> baremetal
ibm_cloud >> vsi
ibm_cloud >> vpc >> vpcarch
ibm_cloud >> powervs

The result is great! 👍 (okay for me only maybe 😊).

This is my first step. Stay tuned for more work to come and thanks for reading.



Alain Airom (Ayrom)

IT guy for a long time, looking for technical challenges everyday!