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.
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.
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.
Recommended Hybrid Architecture
A practical architecture for many teams:
- Receive upload.
- Process original using local disk or EBS scratch space.
- Generate variants such as thumbnails or webp copies.
- Persist canonical and derived files in S3.
- 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
- Should I stick only to AWS RDS Automated Backup or DB Snapshots?
- Should I use a single AWS Load Balancer in a distributed environment?
- Should I use Amazon's AWS Virtual Private Cloud VPC
- Should I use AWS Cognito username or sub uid for storing in database?
- Should I use AWS Elastic Beanstalk or the Amazon EC2 Container Service ECS to scale Docker containers?
- Should I use AWS Elastic Beanstalk or the Amazon EC2 Container Service ECS to scale Docker containers?
- sidecar vs init container in kubernetes
- Signing ElasticSearch AWS calls

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack 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.