Unsaved
Ready
Loading Monaco Editor...
Preview
Styling
Flowchart
All Software Architecture templates

Serverless Image Processing Pipeline — Mermaid Flowchart

Flowchart of a serverless image upload and processing pipeline with S3, Lambda, and CDN delivery.

What this diagram shows

This Mermaid flowchart is an upload that never touches an application server. The user upload hits a validation diamond. Invalid files return an error. Valid files land in an S3 raw bucket, and the S3 event invokes Lambda. Lambda produces a thumbnail and a WebP rendition, writes both to a processed bucket, and stores EXIF in DynamoDB. CloudFront serves the processed bucket. A Lambda failure is pushed to SQS and the queue points back at Lambda.

Use it when you are choosing a media pipeline and need to show the split between the original object and the renditions. The raw bucket and the processed bucket are separate nodes so a lifecycle rule on originals does not look like it deletes thumbnails. The SQS loop is the retry story; there is no dead-letter node yet.

Validation is the only diamond. Everything after a valid file is a straight path plus the failure edge into the queue. That keeps the happy path readable on a slide.

Mermaid syntax in this template

flowchart TD stacks the upload at the top and the CDN near the bottom. The retry edge is a backward arrow from SQS to Lambda.

  • Validate{Validate File}

    One diamond, two labels: Invalid returns the error rectangle, Valid continues to the raw bucket.

  • S3Raw[S3: Raw Bucket]

    Buckets are rectangles here, not cylinders, because the label is the product name. Switch to [( )] if you want every store to share a shape.

  • Lambda -->|Failure| SQS

    The failure label is on the edge, not a second diamond. Lambda still has three success edges to thumbnail, WebP, and metadata.

  • SQS --> Lambda

    The back edge is the retry. It will render as a loop. Do not also point SQS at the user or the retry looks like a new upload.

Variations and ways to customize it

Cap the retries

A queue that always returns to Lambda will cycle forever in the diagram and in the architecture. Add a diamond on receive count and a dead-letter bucket.

SQS --> Attempts{Receive Count < 3?}
Attempts -->|Yes| Lambda
Attempts -->|No| DLQ[SQS Dead Letter]

Add a virus scan

Put a scan node between the raw bucket and Lambda. Infected files should exit to a quarantine bucket and must not reach the processed bucket or CloudFront.

S3Raw --> Scan[Scan for Malware]
Scan -->|Infected| Quarantine[Quarantine Bucket]
Scan -->|Clean| Lambda

Serve originals too

CloudFront currently sits only on the processed bucket. Add a second behavior from CloudFront to the raw bucket if downloads of the original are a product feature, and label the edges thumb vs original.

Diagram type

Flowchart

Tags

serverlessLambdaS3image processingCDN
Open in Editor

Frequently asked questions

Which bucket does CloudFront read in this flowchart?

The processed bucket. Thumbnails and WebP are written there. The raw bucket is the event source for Lambda and is not on the CDN edge in this template.

How are Lambda failures retried in the diagram?

The failure edge lands on SQS, and SQS points back to Lambda. There is no max-receive or dead-letter node. Add one before you treat the chart as an operations design.

Where does EXIF metadata go?

DynamoDB. The image bytes never go to DynamoDB. The metadata node is a sibling of the thumbnail and WebP nodes, all three leaving Lambda.

Can I swap Lambda for a container worker?

Yes. Rename the Lambda node to a worker and keep the S3 event as the trigger. The validation diamond, the two buckets, and the CDN stay. Change the SQS edge only if the worker handles retries internally.

Related templates and guides

All Software Architecture templates