Diagrams are playing one of the major role in software development, Architecture development and Cloud infrastructure building.
This python package diagrams is really helpful to Software architect, Solutions architect, Cloud engineers and Enterprise architect to keep our infrastructure diagram as code
Benefits
- Easy to understand
- Help to simplify the process
- Proper documentation
- Versioning our infrastructure diagrams changes as code
- Easy to customise
- Open source
It's currently supports main major providers including: AWS, Azure, GCP, Kubernetes, Alibaba Cloud, Oracle Cloud etc... It also supports On-Premise nodes, SaaS and major Programming frameworks and languages
Installation
It requires python 3.6 version or heigher version python package
#using pip (pip3)
$ pip install diagrams
Quick start
# SampleDiagram.py
from diagrams import Diagram
from diagrams.aws.compute import EC2
from diagrams.aws.database import RDS
from diagrams.aws.network import ELB
#create diagram
with Diagram("Web Service", show=False):
ELB("lb") >> EC2("web") >> RDS("userdb")
to run the above code in your terminal
$ python SampleDiagram.py
output
Example Clustered web service Infrastructure
#ClusterWebService.py
from diagrams import Cluster, Diagram
from diagrams.aws.compute import ECS, Lambda
from diagrams.aws.database import ElastiCache, RDS
from diagrams.aws.network import ELB, Route53
from diagrams.aws.integration import SQS
from diagrams.aws.storage import S3
#create diagram
with Diagram("Clustered Web Services", show=False):
# route53
dns = Route53("dns")
#Elastic load balancer
lb = ELB("App load balancer")
#Elastic containe service cluster
with Cluster("Services"):
svc_group = [ECS("service1"),
ECS("service2"),
ECS("service3")]
#Simple queue service
queue = SQS("SQS service")
#Relational Database service db cluster
with Cluster("RDS DB Cluster"):
db_primary = RDS("userdb")
db_primary - [RDS("backup")]
#lambda functions cluster
with Cluster("Lambdas"):
handlers = [
Lambda('Lambda 1'),
Lambda('Lambda 2'),
Lambda('Lambda 3'),
]
#Elasticcache service
memcached = ElastiCache("memcached")
# S3 serive
store = S3("File storage")
#architecture work flow
dns >> lb >> svc_group >> queue >> handlers
handlers[0] >> memcached
handlers[1] >> store
handlers[2] >> db_primary
to run the code
$ python ClusterWebService.py
output
- Link to library diagrams
- Github link : Click here
Follow Cloudnloud tech community to know more Linux,Cloud,DevOps,Docker,K8s,Seccurity,Solutions,Re-Engineering,Virtuvalization,Data,AI,Python,Ansible,Terraform information
Keep Learning Keep Growing !!!
Top comments (0)