File Processingadvanced5 minute guide

Secure File Upload and Malware-Scanning Pipeline on AWS

This architecture keeps large upload bytes out of the API, lands every object in an encrypted trust boundary, scans before promotion, quarantines suspicious files, and exposes processing status to the application. It is a security-focused workflow rather than a generic upload shortcut.

Open editable diagram

Published August 18, 2026

Reference architecture

Architecture diagram

Edit this exact diagram
Secure AWS file upload architecture diagram with Cognito, presigned S3 upload, GuardDuty malware scanning, clean and quarantine buckets, KMS, Step Functions, and DynamoDB statusOpen on the canvas

Secure AWS file upload architecture diagram with Cognito, presigned S3 upload, GuardDuty malware scanning, clean and quarantine buckets, KMS, Step Functions, and DynamoDB status. The image links to a fully editable BuildPlane starter.

Overview

A hardened upload pipeline where authenticated clients receive short-lived presigned URLs and upload directly to an encrypted S3 landing bucket. Object-create events trigger GuardDuty malware scanning; a router promotes clean objects and quarantines the rest, all under a customer-managed KMS key. A Step Functions flow post-processes clean files while DynamoDB tracks status and SNS notifies the app.

Components

  • Upload Ingress: API Gateway with Cognito authorizes uploads and issues scoped presigned URLs.
  • Object Storage: Landing, clean, and quarantine buckets create a clear trust gradient, all encrypted by the KMS key.
  • Scan + Process: An SQS-fed router acts on GuardDuty verdicts, then a Step Functions flow derives thumbnails and metadata.
  • Status: DynamoDB records per-file status and SNS notifies the application.
  • Encryption: A customer-managed KMS key enforces server-side encryption on every bucket.

Upload Flow

  1. The client authenticates and requests a presigned URL from the upload API.
  2. The client PUTs the file directly to the encrypted landing bucket.
  3. An object-created event queues the file; GuardDuty scans it and the router moves it to clean or quarantine.
  4. Clean objects trigger the post-process flow, which writes status and derivatives.
  5. The app is notified via SNS when a file is ready or rejected.

Customize First

  • Swap GuardDuty for a third-party AV engine, or add content-type and size checks in the presign step.
  • Add object-lock/retention on quarantine and a human-review workflow for flagged files.
  • Stream the status table via DynamoDB Streams to update the app in real time.

Design rationale

Decisions that shape this architecture

1

Authorize metadata, then upload directly to S3

The API issues a short-lived, narrowly scoped presigned URL. File bytes avoid the Lambda request path while the application still controls object name, size, ownership, and allowed content type.

2

Treat the landing bucket as untrusted

New objects remain isolated until the scanning verdict is available. Only an authorized routing step can promote a clean object or move a suspicious object to quarantine.

3

Expose processing state explicitly

DynamoDB records upload and scan status, while SNS can notify the application. Users should not infer safety or readiness from object existence alone.

Before production

Operational checks

Constrain presigned URLs by object key, expiry, size, and expected content type.

Block reads from the landing and quarantine buckets for normal application roles.

Test malware-positive, scanner-error, timeout, and duplicate-event paths.

Define retention, legal hold, and operator access for quarantined objects.

Scope and tradeoffs

What this diagram does not solve

Malware scanning is one validation layer

Content parsing, decompression limits, media transcoding, document sanitization, and business validation may still be required for the file type.

Presigned URLs need server-side policy

A presigned URL delegates a specific storage operation. The issuing API must prevent arbitrary keys, oversized uploads, tenant crossover, and unsafe metadata.

Common questions

Frequently asked questions

Why upload directly to S3 instead of through Lambda?

Direct upload avoids API and function payload limits, reduces compute cost, and lets S3 handle large object transfer reliably.

When can the application serve the uploaded file?

Only after the scanning and validation workflow marks it clean and promotes it into the trusted storage boundary.

Should quarantine objects be deleted immediately?

Retention depends on incident response, privacy, and compliance policy. Keep access tightly controlled and automate deletion when the approved retention window ends.

Keep exploring

View all 17 guides
AWS data lake and analytics architecture diagram with Kinesis, Firehose, Lambda, Glue, raw and curated S3 zones, Lake Formation, Athena, Redshift, and QuickSight
Data Platformadvanced

Governed Data Lake and Analytics Platform on AWS

This architecture supports both near-real-time processing and batch-oriented curation. Kinesis fans data into a fast Lambda path and a Firehose landing path, Glue creates query-ready datasets, and Lake Formation applies governance across Athena, Redshift, and QuickSight.

Explore the architecture

From reference to working draft

Adapt this architecture with your AWS AI Agent

Start from the exact diagram in this guide. Change requirements, challenge a decision, or ask what fails first, while keeping the architecture editable.

Open editable diagram