EBS
S3
Image Storage
Cloud Storage
AWS

Should I persist images on EBS or S3?

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

For most web and mobile systems, persistent image storage should be on S3, not EBS. EBS is excellent block storage for a specific compute instance, while S3 is object storage designed for shared durable access at scale. Choosing correctly early avoids complex replication and failover work later.

EBS and S3 Solve Different Problems

EBS acts like an attached disk volume. It is ideal for instance-local workloads that need low-latency filesystem semantics.

S3 is object storage accessed over API calls. It is designed for durable shared assets, lifecycle policies, and integration with CDN delivery.

For image persistence, typical requirements are:

  • Durable long-term storage.
  • Access from many services.
  • Global delivery with caching.
  • Policy-driven retention.

Those requirements align naturally with S3.

When S3 Is the Right Default

S3 is usually the better persistence layer when images are part of product data or user-uploaded content.

python
1import boto3
2
3s3 = boto3.client("s3", region_name="us-east-1")
4
5bucket = "my-app-images"
6key = "users/42/avatar.jpg"
7file_path = "/tmp/avatar.jpg"
8
9s3.upload_file(
10    file_path,
11    bucket,
12    key,
13    ExtraArgs={
14        "ContentType": "image/jpeg",
15        "ACL": "private"
16    }
17)
18
19print(f"stored s3://{bucket}/{key}")

Serving patterns then become straightforward with presigned URLs or CloudFront.

Where EBS Still Fits

EBS can still be valuable for image processing stages:

  • Temporary working files during conversion.
  • Batch pipelines that need local fast scratch space.
  • Legacy applications with strict filesystem assumptions.

In these designs, EBS should be treated as processing cache, not permanent system of record.

If persistent image data only exists on EBS attached to one instance, availability and scaling become operationally fragile.

A practical architecture for many teams:

  1. Receive upload.
  2. Process original using local disk or EBS scratch space.
  3. Generate variants such as thumbnails or webp copies.
  4. Persist canonical and derived files in S3.
  5. Deliver through CloudFront.

This pattern combines fast local processing with durable scalable storage and distribution.

Cost and Performance Tradeoffs

Do not compare only storage price per GB. Include:

  • Data transfer patterns.
  • Engineering effort for replication.
  • Recovery complexity under failures.
  • CDN and cache-hit behavior.

S3 often wins total ownership cost for persistent images because it removes custom replication and backup burden.

EBS can be efficient for short-lived compute-heavy operations near application instances.

Security Design

Regardless of storage choice, access control should be explicit.

S3 best practices:

  • Keep bucket private by default.
  • Use IAM roles and narrow policies.
  • Enable server-side encryption.
  • Use signed URL patterns for client access.

EBS best practices:

  • Encrypt volume and snapshots.
  • Restrict instance access and credentials.
  • Harden host-level permissions because filesystem compromise exposes data.

For internet-facing image delivery, S3 plus CloudFront usually offers cleaner security boundaries.

Availability and Recovery

S3 durability and managed redundancy significantly reduce recovery burden. EBS snapshots help, but recovery orchestration is still your responsibility.

If your image catalog is business-critical, using S3 for persistence usually improves incident response and reduces recovery time objectives.

For disaster drills, S3 replication and object versioning are typically easier to validate repeatedly than custom EBS-based synchronization playbooks.

Common Pitfalls

  • Using EBS as sole persistent image store in horizontally scaled apps.
  • Persisting in S3 but still routing every image through app servers unnecessarily.
  • Ignoring lifecycle and storage-class policies for old variants.
  • Applying public bucket access to private user content.
  • Underestimating egress and transformation costs during growth.

Summary

  • S3 is usually the best default for persistent image storage.
  • EBS is better suited for instance-local temporary processing.
  • A hybrid approach often delivers the best balance for image pipelines.
  • Include operational recovery and engineering effort in cost decisions.
  • Design private access and CDN delivery patterns from the start.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.