Infrastructure Digrams as Code

Search for a command to run...

No comments yet. Be the first to comment.
API (Application Programming Interface) security is critical for protecting sensitive data and maintaining the integrity of systems and applications. APIs are used to connect different systems and applications, and as a result, they can provide a gat...

Well after months of deep slumber, away from social media networks, I had to return to Pune and adapt to hybrid working. I was browsing through meetup.com and was intrigued by one event from AWS user group Pune. It is AWS Reinvent 2022 -Recap on 21st...

Episode 2

Simplify Access Control and Enhance Transparency Over Your ML Projects

Episode 1

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
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.
It requires python 3.6 version or heigher version python package
# using pip (pip3)
$ pip install diagrams
# 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

#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
Keep Learning Keep Growing !!!