Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added k8s-cluster-overview-azure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions k8s-cluster-overview.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from diagrams import Diagram, Edge, Cluster
from diagrams.azure.network import ApplicationGateway, LoadBalancers
from diagrams.azure.compute import AKS, KubernetesServices, ContainerRegistries
from diagrams.azure.storage import StorageAccounts
from diagrams.azure.database import DatabaseForPostgresqlServers
from diagrams.azure.monitor import Monitor

with Diagram("Kubernetes Cluster Overview (Azure)", filename="k8s-cluster-overview-azure", show=False, direction="LR"):
# External traffic
app_gw = ApplicationGateway("App Gateway / ALB")

# Kubernetes cluster (AKS)
with Cluster("AKS Cluster"):
aks = AKS("AKS")
pod1 = KubernetesServices("Pod: app-1")
pod2 = KubernetesServices("Pod: app-2")

# Supporting services
acr = ContainerRegistries("ACR")
blob = StorageAccounts("Blob Storage (PV)")
db = DatabaseForPostgresqlServers("Azure DB for PostgreSQL")
monitor = Monitor("Azure Monitor")

# Interactions
app_gw >> Edge(label="Ingress") >> aks
aks >> Edge(label="Schedules/Routes") >> pod1
aks >> Edge(label="Schedules/Routes") >> pod2

pod1 >> Edge(label="Store PVC") >> blob
pod2 >> Edge(label="Store PVC") >> blob

pod1 >> Edge(label="Query") >> db
pod2 >> Edge(label="Query") >> db

acr >> Edge(label="Images") >> aks

# Monitoring
aks >> monitor
db >> monitor
blob >> monitor
Binary file added serverless-architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions serverless-architecture.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
from diagrams import Diagram, Cluster
from diagrams.aws.compute import Lambda
from diagrams.aws.database import Dynamodb
from diagrams.aws.storage import S3
from diagrams.aws.network import APIGateway
from diagrams.aws.security import Cognito
from diagrams.aws.integration import SNS, SQS
from diagrams.aws.management import Cloudwatch


with Diagram("Serverless Architecture", show=True, filename="serverless-architecture", outformat="png"):
# Public API + Auth
api_gateway = APIGateway("API Gateway")
user_auth = Cognito("Cognito User Pool")

# Core compute and storage
lambda_function = Lambda("API Lambda")
dynamodb = Dynamodb("DynamoDB")
s3 = S3("S3")

# Async messaging and worker
sns = SNS("SNS Topic")
sqs = SQS("SQS Queue")
worker = Lambda("Worker Lambda")

# Monitoring
cw = Cloudwatch("CloudWatch")

# Group the serverless backend for clarity
with Cluster("Serverless Backend"):
lambda_function >> dynamodb
lambda_function >> s3
lambda_function >> sns

# Async delivery to worker via SQS subscription
sns >> sqs
sqs >> worker

# API and auth flow
api_gateway >> user_auth
api_gateway >> lambda_function

# Monitoring connections (informational)
lambda_function >> cw
worker >> cw
dynamodb >> cw