Skip to content

Instantly share code, notes, and snippets.

@BlueDoge
Created June 21, 2022 02:28
Show Gist options
  • Save BlueDoge/4df4029aa140be5240be08a4417f5639 to your computer and use it in GitHub Desktop.
Save BlueDoge/4df4029aa140be5240be08a4417f5639 to your computer and use it in GitHub Desktop.
python Diagrams example
from diagrams import Cluster, Diagram
from diagrams.aws.compute import LambdaFunction
from diagrams.aws.database import DDB
from diagrams.aws.storage import SimpleStorageServiceS3BucketWithObjects, S3Glacier
from diagrams.aws.network import Route53, APIGateway, APIGatewayEndpoint, ElasticLoadBalancing
from diagrams.aws.integration import Eventbridge, SQS
with Diagram("Second Life Marketplace ANS Processor on AWS", show=False):
with Cluster("Data Control"):
dns = Route53("DNS Records")
gateway = APIGateway("API Gateway")
controller = dns - gateway
apiep = APIGatewayEndpoint("SLM ANS URL")
lb = ElasticLoadBalancing("Processor ELB")
with Cluster("Processors"):
pcr_group = [LambdaFunction("proc_func1"),
LambdaFunction("proc_func2"),
LambdaFunction("proc_func3")]
with Cluster("Queue"):
initqueue = SQS("DataQueue")
queuetoddb = LambdaFunction("DQ to DDB parser")
queue_group = initqueue >> queuetoddb
with Cluster("Database"):
db_primary = DDB("dynamodb")
db_events = Eventbridge("Daily Event")
db_lambda = LambdaFunction("Record Parser")
db_solution = db_primary - db_events >> db_lambda
with Cluster("Storage Solution"):
storage = SimpleStorageServiceS3BucketWithObjects("Monthly Data")
s3_events = Eventbridge("Lifecycle Events")
deep_storage = S3Glacier("Cold Storage")
storage_solution = storage - s3_events >> deep_storage
controller - apiep >> lb >> pcr_group
pcr_group >> initqueue
queue_group >> db_primary
db_solution >> storage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment