home
diamond Go Premium
Data Engineering Path  ·  Deep Dive
AWS CORE PLATFORM CASE STUDY

AWS S3 Case Study: Distributed Object Storage & Internal Mechanics

Amazon Simple Storage Service (S3) is a highly durable, scalable, and secure object storage service designed from first principles. Unlike a traditional OS filesystem that uses hierarchical directories and index nodes (inodes), S3 is a flat-namespace distributed key-value store running on commodity hardware.

AWS S3 Architecture & Core Ecosystem


1. Fundamentals of Amazon S3

S3 stores data as objects inside containers called buckets.

Core Architecture Concepts:

  • Key-Value Model: Every object is uniquely identified by a Key (the full path string, e.g., images/logos/s3.png) and a Value (the raw binary payload bytes).
  • Flat Namespace: Subfolders do not physically exist in S3 storage nodes. The slashes (/) in a key are purely logical delimiters parsed by client interfaces.
  • Global Uniqueness: Bucket names must be globally unique across all AWS accounts and regions.
  • Object Size Constraints:
    • An object size can range from 0 bytes to 5 TB.
    • A single PUT API request can upload an object up to 5 GB in size.
    • Multipart Uploads: For any object larger than 100 MB (and mandatory for objects larger than 5 GB), the object must be split into multiple parts, uploaded concurrently, and reassembled by S3. This increases upload throughput and allows S3 to recover from network failures during transfer.

S3 Storage Classes:

S3 provides curated storage classes optimized for different lifecycle stages and access patterns:

Storage Class Durability Availability Billing Design Minimum Storage Duration
S3 Standard $99.999999999\%$ $99.99\%$ High storage cost; free data access. None
S3 Intelligent-Tiering $99.999999999\%$ $99.9\%$ Automates tiering based on access; small monitoring fee. None
S3 Standard-Infrequent Access (IA) $99.999999999\%$ $99.9\%$ Lower storage cost; retrieval fee per GB. 30 Days
S3 One Zone-IA $99.999999999\%$ (Single AZ) $99.5\%$ $20\%$ cheaper than Standard-IA; vulnerable to AZ loss. 30 Days
S3 Glacier Instant Retrieval $99.999999999\%$ $99.9\%$ Archival storage cost with millisecond-level retrieval. 90 Days
S3 Glacier Flexible Retrieval $99.999999999\%$ $99.99\%$ Archives retrieved in 1 min (expedited) to 5 hours. 90 Days
S3 Glacier Deep Archive $99.999999999\%$ $99.99\%$ Lowest storage cost; retrieval takes 12 hours. 180 Days

2. Bucket Configurations & The "Properties" Tab

The Properties tab in the AWS Console contains settings that control object behavior, logging, security compliance, and event integration.

1. Bucket Versioning

Versioning keeps a continuous ledger of every change made to objects in the bucket.

  • Overwrite Protection: Overwriting an object creates a new version with a unique Version ID, preserving the previous version.
  • Accidental Deletes: Deleting an object puts a Delete Marker on the key. The object appears deleted, but the previous versions remain intact and can be restored by deleting the Delete Marker.
  • Permanently Deleting: To permanently delete an object, you must target the specific Version ID in the delete request.

2. Tags

Key-value labels associated with the bucket. Tags are primarily used for tracking costs in AWS Cost Allocation Reports, allowing enterprises to allocate bucket storage fees to specific business units or projects.

3. Default Encryption

S3 automatically encrypts all incoming objects at the bucket level. S3 supports several Server-Side Encryption (SSE) modes:

  • SSE-S3 (Server-Side Encryption with S3 Managed Keys): Uses AES-256 GCM. Keys are managed, rotated, and secured automatically by S3. This is the free, default option.
  • SSE-KMS (SSE with AWS KMS Keys): S3 uses keys created and managed in AWS Key Management Service. Provides granular IAM control over key usage and auditing via CloudTrail logs, but incurs KMS usage fees.
  • SSE-C (SSE with Customer-Provided Keys): The client provides the encryption key in the headers of each HTTP request. S3 performs the encryption/decryption in memory and discards the key. The customer is entirely responsible for storing and managing the keys.
  • DSSE-KMS (Dual-Layer SSE-KMS): Applies two separate, independent layers of encryption (using distinct KMS keys) to objects at rest for strict regulatory compliance.

4. Server Access Logging

Detailed logging of all requests made to the bucket.

  • Mechanics: Every API call (GET, PUT, DELETE, LIST, auth failures) is recorded in JSON/Text log files and written to a separate target S3 bucket.
  • Use Case: Crucial for security audits, forensic analysis, and troubleshooting bucket access control.

5. AWS CloudTrail Data Events

While Server Access Logs are written asynchronously, S3 can integration with AWS CloudTrail to record object-level data actions (e.g., GetObject, PutObject) as they occur. CloudTrail logs provide uniform trail structures and integrate directly with Amazon EventBridge.

6. Event Notifications

Enables buckets to react automatically to object actions (e.g., when a file is uploaded or deleted).

  • Triggers: ObjectCreated, ObjectRemoved, ObjectRestore, etc.
  • Destinations:
    • AWS Lambda: Trigger an inline serverless function to process the object (e.g., thumbnail generation, ETL parsing).
    • Amazon SQS (Simple Queue Service): Send a message to a FIFO or Standard queue for decoupled consumer processing.
    • Amazon SNS (Simple Notification Service): Publish a message to a topic to notify multiple endpoints or email lists.

7. Amazon EventBridge

An alternative to native S3 Event Notifications. Sending bucket events to EventBridge allows you to create rules that filter, transform, and route events to over 15 target AWS services with more granular rule conditions.

8. Transfer Acceleration

Enables fast, secure, long-distance file transfers to and from your S3 bucket.

  • How it Works: Instead of uploading over the public internet, requests go to the nearest Amazon CloudFront Edge Location. The edge location routes the traffic over AWS's high-speed private global network directly to the S3 bucket's region.

9. Object Lock

Enforces WORM (Write Once, Read Many) compliance to prevent objects from being deleted or overwritten.

  • Governance Mode: Users with special permissions (like root or users holding the s3:BypassGovernanceRetention permission) can bypass the retention settings.
  • Compliance Mode: The retention period is locked. No user, including the AWS root account, can delete or overwrite the objects during the retention duration.
  • Legal Hold: An indefinite lock placed on an object. It stays locked until explicitly removed by a user with permission; there is no expiration timer.

10. Requester Pays

By default, the bucket owner pays for storage, data transfer out, and API requests. If Requester Pays is enabled:

  • The bucket owner still pays for storage.
  • The requester (the user downloading the data) pays for the data transfer costs and API requests.
  • Requesters must include x-amz-request-payer: requester in their HTTP headers to acknowledge payment responsibility.

11. Static Website Hosting

Configures the bucket to behave like a web server.

  • Endpoints: S3 generates a unique, regional URL endpoint (e.g., http://my-bucket.s3-website.us-east-1.amazonaws.com).
  • Configuration: You must define an Index Document (e.g., index.html) and optionally an Error Document (e.g., 404.html) to route root and missing paths.

3. High-Level Architecture & Request Flow

To decouple routing, catalog metadata, and hardware nodes, S3 divides its operations across three primary logical planes:

flowchart TD
    %% Styling Definitions
    classDef client fill:#E1F5FE,stroke:#0288D1,stroke-width:2px,color:#01579B;
    classDef frontend fill:#FFE0B2,stroke:#F57C00,stroke-width:2px,color:#E65100;
    classDef metadata fill:#E8F5E9,stroke:#388E3C,stroke-width:2px,color:#1B5E20;
    classDef storage fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px,color:#F57F17;
    classDef boundary fill:none,stroke:#B0BEC5,stroke-width:1px,stroke-dasharray: 5 5;

    %% Components
    Client["💻 Client Application"]

    subgraph FrontendSection["1. Frontend & Routing Layer"]
        LB["⚖️ Route 53 & Load Balancer"]
        Frontend["⚡ S3 Web Server / Frontend Fleet<br/>(REST API, Auth, IAM checks)"]
    end

    subgraph MetaSection["2. Namespace & Directory Service"]
        DirService["🗄️ Metadata Database<br/>(Prefix Lookup, Key Index, Versioning)"]
    end

    subgraph StorageSection["3. Storage Node Fleet (Multi-AZ)"]
        subgraph AZ1["Availability Zone 1"]
            Store1["💾 Storage Node A<br/>(Data Fragment)"]
        end
        subgraph AZ2["Availability Zone 2"]
            Store2["💾 Storage Node B<br/>(Data Fragment)"]
        end
        subgraph AZ3["Availability Zone 3"]
            Store3["💾 Storage Node C<br/>(Parity Fragment)"]
        end
    end

    %% Flow connections
    Client ==>|PUT/GET Object Request| LB
    LB ==> Frontend
    Frontend <==>|1. Lookup Key Metadata & Location| DirService
    Frontend ==>|2. Write / Read Fragments| Store1
    Frontend ==>|2. Write / Read Fragments| Store2
    Frontend ==>|2. Write / Read Fragments| Store3

    %% Apply CSS classes to nodes
    class Client client;
    class LB,Frontend frontend;
    class DirService metadata;
    class Store1,Store2,Store3 storage;
    class FrontendSection,MetaSection,StorageSection,AZ1,AZ2,AZ3 boundary;

The Request Flow Mechanics:

  1. Ingress: The client requests the S3 endpoint. DNS routes the connection through Amazon Route 53 to the nearest Load Balancers, which distribute requests across the stateless Frontend Web Fleet.
  2. Authentication & Inspection: The frontend parses the REST HTTP headers, decodes Signature v4, and validates authorization against IAM/bucket policies.
  3. Namespace Query: The frontend queries the Namespace Directory Service using the Bucket Name + Key. The directory service resolves version metadata and identifies which physical storage nodes contain the chunks of the requested key.
  4. Payload Streaming: The frontend streams the payload directly to/from the Storage Node Fleet in parallel chunks.

4. Durability & Replication Mechanics (11 Nines)

Achieving $99.999999999\%$ durability requires tolerating simultaneous datacenter outages. S3 uses synchronous replica writes and advanced Reed-Solomon Erasure Coding.

How Erasure Coding Works

For larger object payloads, storing three complete duplicate copies of files (Standard 3-way replication) becomes economically and physically unfeasible at exabyte scale. S3 solves this using Erasure Coding:

  1. An uploaded file is broken into $N$ equal-sized Data Chunks.
  2. An Erasure Coding mathematical algorithm calculates $M$ Parity Chunks (redundant blocks).
  3. All $N + M$ chunks are written synchronously to separate storage nodes across distinct Availability Zones.
  4. Reconstruction: If an entire AZ fails or multiple storage drives fail, S3 reads from any $N$ surviving chunks to dynamically reconstruct the original object data. Under an $8+4$ parity configuration, S3 can survive 4 concurrent chunk losses with zero data degradation while utilizing only $1.5\times$ storage space (compared to $3.0\times$ in traditional 3-way replication).
flowchart TD
    classDef core fill:#E0F7FA,stroke:#00ACC1,stroke-width:2px,color:#006064;
    classDef part fill:#FFF3E0,stroke:#FB8C00,stroke-width:2px,color:#E65100;
    classDef parity fill:#FFFDE7,stroke:#FBC02D,stroke-width:2px,color:#F57F17;
    classDef node fill:#F3E5F5,stroke:#8E24AA,stroke-width:2px,color:#4A148C;
    classDef boundary fill:none,stroke:#90A4AE,stroke-dasharray: 5 5;

    Object["📦 Original Uploaded Object<br/>(e.g., 60 MB file)"]

    subgraph Slicing["1. Slicing & Chunking"]
        P1["📄 Part 1 (20 MB)"]
        P2["📄 Part 2 (20 MB)"]
        P3["📄 Part 3 (20 MB)"]
    end

    subgraph EC["2. Erasure Coding Algorithm"]
        Math["🧮 Reed-Solomon Encoder"]
        Par1["🛡️ Parity 1 (20 MB)"]
        Par2["🛡️ Parity 2 (20 MB)"]
    end

    subgraph Distribution["3. Distributed Storage across AZs"]
        subgraph AZ_A["Availability Zone A"]
            N1["💾 Node 1: Part 1"]
        end
        subgraph AZ_B["Availability Zone B"]
            N2["💾 Node 2: Part 2"]
            N4["💾 Node 4: Parity 1"]
        end
        subgraph AZ_C["Availability Zone C"]
            N3["💾 Node 3: Part 3"]
            N5["💾 Node 5: Parity 2"]
        end
    end

    Object ==> Slicing
    P1 & P2 & P3 ==> Math
    Math ==> Par1 & Par2

    P1 ==> N1
    P2 ==> N2
    P3 ==> N3
    Par1 ==> N4
    Par2 ==> N5

    class Object core;
    class P1,P2,P3 part;
    class Math,Par1,Par2 parity;
    class N1,N2,N3,N4,N5 node;
    class Slicing,EC,Distribution,AZ_A,AZ_B,AZ_C boundary;

5. Strong Read-After-Write Consistency Mechanics

Until late 2020, S3 offered eventual consistency for object PUT (overwrites) and DELETE operations. This was a side-effect of caching catalog index mappings inside the Namespace Directory Service across multiple replication nodes to scale query rates.

Today, S3 enforces Strong Read-After-Write Consistency natively:

  • Barrier Synchronization: When a client issues a PUT, S3 writes the object payload to the storage fleet and issues a commit command to the Directory Service's metadata consensus group.
  • Lock Serialization: The Directory Service serializes namespace updates for the target object key. Conflicting updates are queued.
  • Synchronous Acknowledgment: S3 does not send a 200 OK response to the client until the metadata update has successfully committed to the directory service consensus group. Any subsequent GET or LIST query will instantly route to this updated directory consensus group, eliminating eventual consistency anomalies.

6. Critical Q&A: Advanced Systems Engineering

Q1: How does AWS S3 guarantee Strong Read-After-Write Consistency for lists and overrides without impacting performance?

Answer: S3 achieves this by updating its Namespace Directory Layer to use synchronous consensus commits. When a PUT or DELETE request commits, the request coordinator forces a metadata update across a quorum of directory nodes distributed over multiple AZs. To preserve performance and keep latency low, S3 reads are served from a highly optimized metadata caching layer. S3 uses witness/validation nodes to verify metadata freshness. If a cached partition is out of sync or can't communicate with the witness quorum, S3 bypasses the cache and queries the directory database directly, ensuring you never receive stale metadata.

Q2: Explain S3 Object Lock compliance vs. governance retention modes. Can an AWS root account override compliance retention?

Answer:

  • Governance Mode: Restricts deletion to users with explicit IAM permissions (such as s3:BypassGovernanceRetention or the AWS account root user). This is ideal for testing policies and preventing accidental deletions by standard users.
  • Compliance Mode: Enforces a strict WORM state. No user, including the AWS Root Account, can delete or overwrite the objects, shorten the retention period, or downgrade the lock type. Once committed, it is physically impossible to delete the data until the retention timer expires. This provides maximum protection for regulatory compliance (e.g., SEC Rule 17a-4).

Q3: What is the S3 Multipart Upload process, and what happens to partially uploaded parts of a failed transfer?

Answer: A multipart upload is initialized via an API call that returns an UploadId. The client uploads file segments (ranging from 5 MB to 5 GB) in parallel using the UploadId and part numbers. Once all parts are finished, the client calls CompleteMultipartUpload to commit and reassemble them. If an upload fails or is abandoned:

  • The partially uploaded parts remain stored in S3 indefinitely, and you are billed for their storage even though the object does not show up in bucket listings.
  • Prevention: Always configure an S3 Lifecycle Rule using the AbortIncompleteMultipartUpload action to automatically clean up and delete incomplete part segments after a set number of days.

Q4: How does S3's Reed-Solomon Erasure Coding rebuild data fragments dynamically when a physical disk crashes?

Answer: S3 runs a continuous background process called the Data Integrity Auditor.

  1. When a disk or storage host fails, the auditor detects the missing or corrupted data chunks.
  2. The auditor allocates space on a new storage node and queries the remaining active chunks of the affected object's replication group (e.g., reading 8 surviving chunks of an $8+4$ configuration).
  3. The auditor runs the Reed-Solomon recovery algorithm in memory to calculate the missing data or parity chunk and writes the recovered chunk to the new storage node. This process runs in the background with zero client intervention.

Q5: Explain S3 Block Public Access (BPA) settings and how bucket policies interact with ACLs during evaluation.

Answer: AWS S3 evaluates permissions using an implicit deny model: if a permission is not explicitly allowed, it is denied, and any explicit deny overrides an allow.

  • S3 Block Public Access (BPA): Operates as a master override gate at the bucket or account level. If enabled, it overrides and ignores any public ACLs or public bucket policies, preventing any data from being made public.
  • ACLs vs. Bucket Policies: S3 evaluates both. An ACL grants access at the object level (legacy), while Bucket Policies evaluate bucket-level access control. If BPA is disabled, an object is public if either a public ACL is applied to it or a public bucket policy allows anonymous read access ("Principal": "*").

References & Further Reading

lock

This content is reserved for Premium Members.

Upgrade to Premium

Entity Details

Create New Item

help

Submit Technical Query

Have a question or run into an issue? Describe it below, upload an optional screenshot, and our engineering team will answer it!

image Attach image (optional)

Submit Feedback

build Free Developer Utility Free Tool
gavel

Privacy & Legal Disclaimer

1. Client-Side Browser Processing

All utility tools on DeepEngineerHub (including Image to PDF, Text Formatters, JSON Converters, and Encryptors) execute 100% locally within your client browser using WebAssembly and JavaScript. No uploaded images, text, or documents are transmitted, collected, or stored on remote servers.

2. Limitation of Liability ("As-Is" Provision)

Tools and services are provided free of charge for convenience and educational purposes "as-is" without warranties of any kind. DeepEngineerHub shall not be held liable for any data loss, formatting inconsistencies, or indirect damages resulting from tool usage.

3. Open Source & Third-Party Software

Certain utilities utilize open-source client libraries (such as jsPDF, Mermaid.js, Pyodide) licensed under MIT, Apache, or BSD open licenses. All intellectual property remains with their respective copyright holders.