Table of Contents

Amazon Locker System Design: (Step-by-Step Guide)

amazon locker system design

If you’ve ever ordered something from Amazon and picked it up from a bright yellow locker instead of your front porch, you’ve already used one of the most fascinating real-world examples of large-scale distributed systems: the Amazon Locker system.

The Amazon Locker System Design problem is a favorite among interviewers because it challenges you to think about IoT, logistics, and cloud-based scalability simultaneously. You’re essentially designing a global network of smart devices, each locker functioning like a tiny computer, that communicates securely with the cloud to manage millions of deliveries every day.

In this guide, you’ll walk through:

  • How to design a scalable and fault-tolerant locker system.
  • How data flows between users, lockers, and Amazon’s servers.
  • How to handle real-world challenges like offline lockers, code verification, and load balancing.
  • How to explain your design decisions in a System Design interview.

By the end, you’ll not only understand how Amazon Lockers work behind the scenes but also how to approach and explain similar System Design questions with confidence.

course image
Grokking System Design Interview: Patterns & Mock Interviews
A modern approach to grokking the System Design Interview. Master distributed systems & architecture patterns for System Design Interviews and beyond. Developed by FAANG engineers. Used by 100K+ devs.

Problem Statement and Key Requirements

Let’s start by defining what we’re building. Amazon Locker System Design aims to create a service that allows users to securely pick up packages from self-service lockers located in convenient locations.

Each locker unit connects to a backend system that tracks packages, communicates pickup codes, and ensures that users can retrieve their parcels smoothly, all while supporting millions of transactions per day worldwide.

Functional Requirements

When you design this for your System Design interview question, your architecture should support the following actions:

  1. Locker assignment
    • Automatically assign an available locker based on package size and location.
  2. Package delivery
    • A delivery associate deposits the package into the assigned locker.
  3. User notification
    • Send a unique pickup code or QR code to the user via SMS, email, or app.
  4. Package pickup
    • User enters the code at the locker touchscreen, and the system unlocks the correct door.
  5. Locker maintenance and updates
    • Report locker status, errors, temperature, or network issues to the backend for monitoring.

Non-Functional Requirements

A production-grade Amazon Locker System Design also needs to be robust, fast, and secure:

  • Scalability: Must handle millions of deliveries per day.
  • Reliability: Lockers must operate 24/7, even during partial network outages.
  • Low Latency: Users should unlock lockers within seconds.
  • Fault Tolerance: Automatic retries for locker communication failures.
  • Security: Ensure encrypted access codes, secure hardware communication, and proper authentication.
  • Maintainability: Easy to deploy software updates to lockers remotely.

Constraints and Assumptions

To keep the design realistic and focused:

  • Each locker has multiple compartments (slots).
  • Each slot can hold one package at a time.
  • Communication between locker and backend is intermittent (IoT constraint).
  • System should support eventual consistency—local state syncs with the server when online.

This phase of the design discussion sets the foundation for your System Design interview practice. Before jumping into architecture, always clarify functional goals, constraints, and assumptions—it’s one of the top habits interviewers look for.

Real-World Workflow: From Delivery to Pickup

Now that we’ve defined what we’re building, let’s visualize how the Amazon Locker System Design works from a user’s perspective.

Here’s the complete lifecycle of a package:

Step 1: Delivery and Locker Assignment

When a user places an order and chooses “Deliver to Amazon Locker,” the system identifies the nearest locker location with available space.

  • The package size and locker slot dimensions are matched.
  • The backend service reserves a specific locker slot.
  • The assigned locker’s status is updated from availablereserved.

Step 2: Delivery Agent Drops the Package

The delivery agent arrives at the locker station with the package.

  • They authenticate via a delivery app using secure credentials.
  • The system instructs the locker to unlock the assigned slot.
  • The agent places the package inside, closes the door, and the locker confirms success to the server.

Step 3: User Notification

Once the package is safely stored, the system generates a unique pickup code or QR code linked to that package and locker.

  • The code is sent to the user through email, SMS, or the Amazon mobile app.
  • A countdown timer starts for pickup expiration (typically 3 days).

Step 4: Package Pickup

When the user arrives at the locker location:

  • They enter the code or scan the QR on the locker touchscreen.
  • The locker verifies the code with the backend (or locally if offline).
  • If valid, the corresponding slot unlocks automatically.
  • The system records the pickup time and updates the package’s state to retrieved.

Step 5: Post-Retrieval and Monitoring

After pickup, the system marks the slot as available again.

  • Locker sends event logs and health metrics (connectivity, power, door status) to the monitoring service.
  • Backend systems use this data for predictive maintenance and availability analytics.

Actors in the System

  • User: The customer retrieving the package.
  • Delivery Agent: The person delivering packages into lockers.
  • Locker Hardware: The IoT-enabled device storing and managing compartments.
  • Backend System: The cloud infrastructure that orchestrates package assignment, security, and communication.

This user journey clarifies how the system must coordinate between software, hardware, and humans—a classic example of real-world System Design complexity.

High-Level Architecture Overview

Let’s break down what the Amazon Locker System Design looks like from a technical architecture perspective.

The system is a hybrid of IoT and cloud-based architecture, combining physical hardware (lockers) with software services (backend APIs, databases, monitoring tools).

Key Components

  1. Frontend Interfaces
    • User App / Web Portal: For choosing locker delivery and viewing pickup info.
    • Delivery Agent App: For authentication and package drop.
    • Locker Screen UI: For user input and local operations.
  2. Backend Services
    • Locker Management Service: Tracks lockers, slot states, and health.
    • Package Service: Handles package-to-locker mapping and lifecycle.
    • Authentication Service: Validates users, agents, and devices.
    • Notification Service: Sends OTPs, QR codes, and reminders.
  3. Database Layer
    • Stores locker data, package metadata, user info, and logs.
    • Must support geo-partitioning to handle global scale efficiently.
  4. Locker IoT Device
    • Runs lightweight firmware that communicates with backend servers.
    • Performs actions like “unlock slot” or “report door status.”
    • Uses MQTT or HTTPS for communication.
  5. Monitoring and Analytics Layer
    • Monitors locker uptime, failures, and power/network issues.
    • Alerts support teams for maintenance needs.

Example Architecture Flow

User/Delivery App → API Gateway → Locker Management Service 

→ Database + Notification System → Locker IoT Client → Analytics Layer

Design Principles

  • Resilience: Local caching and fallback operations for offline mode.
  • Security: Encrypted communication between locker and server.
  • Scalability: Horizontally scalable services and globally distributed databases.
  • Observability: Logging and metrics collection for real-time visibility.

At a glance, the system functions as a distributed network of smart devices communicating with a centralized orchestration layer, just like modern IoT systems such as Tesla charging networks or vending machine networks.

Database Design and Data Modeling

The database is the backbone of the Amazon Locker System Design. It stores everything, from user preferences and package details to locker health metrics and access logs.

Let’s explore how to structure it effectively.

Core Entities

  1. Locker Table
    • locker_id (primary key)
    • location_id
    • number_of_slots
    • available_slots
    • status (active/inactive/offline)
  2. Slot Table
    • slot_id
    • locker_id
    • size (small/medium/large)
    • state (available/reserved/occupied)
  3. Package Table
    • package_id
    • user_id
    • locker_id
    • slot_id
    • delivery_status (in transit, stored, picked up, expired)
    • timestamp_created, timestamp_picked
  4. User Table
    • user_id
    • name, email, phone
    • preferred_location
    • account_status
  5. AccessLog Table
    • log_id
    • locker_id, slot_id, user_id, action_type (open/close/error)
    • timestamp

Data Storage Considerations

  • Use relational databases (PostgreSQL/MySQL) for transactional integrity.
  • Implement NoSQL caching (like Redis) for fast reads (e.g., locker availability).
  • Use geo-sharding to minimize latency for region-based queries.
  • Keep locker health data in a time-series database for trend analysis.

Data Lifecycle Management

  1. Active Data: Current deliveries and locker states.
  2. Archived Data: Pickup histories and expired packages.
  3. Deleted Data: Retained briefly for audit, then purged securely.

Efficient data modeling ensures real-time lookups, scalable writes, and easy data recovery, all critical in a high-volume distributed system like Amazon Lockers.

Locker Assignment and Package Allocation Logic

The next challenge in Amazon Locker System Design is efficiently allocating lockers to incoming packages.

Imagine millions of packages and thousands of lockers across regions—your allocation logic must balance speed, availability, and geographical proximity.

1. Locker Selection Criteria

When a package arrives for delivery, the system selects a locker based on:

  • User location or chosen pickup point.
  • Locker availability (open slots).
  • Package size and slot dimensions.
  • Locker operational status (active and connected).

If multiple lockers qualify, the system picks the nearest or least loaded one to ensure even distribution.

2. Algorithmic Approach

  • Geo-Hashing:
    Convert geographical coordinates into hash values to efficiently search lockers within a radius.
  • Availability Cache:
    Maintain real-time slot availability in Redis or Memcached to reduce database queries.
  • Priority Queues:
    Rank lockers by distance, availability, and usage frequency for quick selection.

3. Edge Case Handling

  • All lockers full: Queue the package for retry or redirect to an alternate location.
  • Package too large: Assign to a specialized locker with oversized compartments.
  • Multiple deliveries for one user: Group them into adjacent slots to simplify pickup.

4. Load Balancing Across Lockers

To prevent overloading high-demand lockers, use region-based load balancing:

  • Distribute deliveries evenly across nearby lockers.
  • Monitor usage metrics to identify hotspots.
  • Dynamically adjust locker assignment logic based on load.

5. Optimization for Scalability

  • Pre-calculate locker capacity utilization daily to forecast demand.
  • Use machine learning models to predict locker demand in specific regions (optional advanced feature).

By optimizing allocation logic, you ensure smooth package flow, reduce congestion, and deliver a fast, reliable user experience—the exact kind of reasoning that impresses interviewers in System Design discussions.

IoT Communication: Connecting Lockers with the Cloud

A key part of the Amazon Locker System Design is how smart lockers communicate with the backend servers. Since each locker acts like an IoT (Internet of Things) device, it needs a reliable and secure way to exchange data, even under unstable network conditions.

How Communication Works

Each locker unit has a small embedded computer or microcontroller that connects to Amazon’s cloud infrastructure through a secure channel. The locker and backend continuously exchange small packets of information, such as:

  • Locker availability and health status.
  • Commands to unlock specific compartments.
  • Error or malfunction notifications.
  • Periodic “heartbeat” signals to confirm connectivity.

Communication Patterns

There are two main communication modes in this system:

  1. Asynchronous updates
    • The locker periodically sends data like temperature, power status, or door usage logs.
    • This helps the backend maintain up-to-date information without constant polling.
  2. Synchronous commands
    • When a user enters a pickup code, the backend sends an unlock command to the specific locker.
    • The locker confirms success or failure in real time.

These patterns make the system responsive and lightweight—two essential traits of scalable IoT design.

Protocols and Security

To ensure smooth communication, the lockers typically use lightweight, reliable protocols like:

  • MQTT (Message Queuing Telemetry Transport): Designed for low-bandwidth IoT communication.
  • HTTPS or WebSocket APIs: Used when larger data payloads or real-time two-way communication are needed.

Security is enforced at every level:

  • All messages are encrypted with SSL/TLS.
  • Each locker is authenticated with digital certificates issued by Amazon’s IoT service.
  • Commands are signed and time-limited to prevent replay attacks.

Handling Offline Scenarios

Because lockers are often located in places with inconsistent internet access, the system must be resilient to disconnections.

Here’s how it handles downtime:

  • Local caching: The locker stores essential data (like active codes or pending unlocks).
  • Retry queues: Failed messages are retried until delivery succeeds.
  • Eventual consistency: The locker syncs back to the cloud once the connection is restored.

This design ensures that even if a locker temporarily goes offline, it can still serve users, and that reliability is one of the defining strengths of Amazon’s locker network.

Notification and User Interaction System

The next core element in the Amazon Locker System Design is user engagement, specifically, how customers are notified and guided throughout the pickup journey.

Notifications are more than just messages; they are essential for user trust, security, and convenience.

Notification Triggers

  1. Package delivery complete
    • When a delivery agent drops the package and closes the locker door, the system automatically sends a notification.
  2. Pickup code generation
    • The user receives a unique pickup code or QR code via email, app, or SMS.
  3. Pickup reminders and expiration alerts
    • If the package remains uncollected for a few days, the user gets reminders before expiration.
  4. Code expiration or reassignment
    • The system informs the user if their package is being returned due to missed pickup.

Security and Validation

Each pickup code is time-sensitive and unique.

  • Codes expire automatically after a set duration (e.g., 72 hours).
  • Codes cannot be reused once marked as redeemed.
  • Backend verification ensures that only the intended user can open the locker.

When the user arrives:

  • They enter the code or scan a QR code at the locker’s touchscreen.
  • The locker authenticates the input against the server or local cache (if offline).
  • If valid, the corresponding compartment unlocks instantly.

Channels of Communication

The system uses multiple channels for reliability and user preference:

  • Push notifications via mobile app.
  • Email confirmations for detailed pickup information.
  • SMS alerts for fast updates in areas with low data connectivity.

Handling Failures

Failures can occur if users don’t receive their notifications or if messages are delayed. To mitigate this:

  • Implement retry mechanisms for all failed notification attempts.
  • Store unacknowledged messages for follow-up.
  • Provide an in-app “Resend Code” feature for convenience.

In short, notifications turn a complex system into a seamless user experience, ensuring that no one ever wonders where their package went or how to retrieve it.

Security and Access Management

No System Design is complete without addressing security, especially one that involves physical hardware, user data, and real-world access control.

In the Amazon Locker System Design, security is paramount at three levels: data, communication, and physical access.

Data Security

All sensitive data, including user information, package metadata, and access logs, must be encrypted at rest and in transit.

  • Use AES-256 encryption for database storage.
  • Use TLS 1.3 for communication between devices and servers.
  • Hash sensitive identifiers (e.g., user IDs) before logging.

Access to data is role-based:

  • Delivery agents can only access lockers assigned to their route.
  • Users can only access their own packages.
  • Admins can view locker statuses and logs, but cannot generate access codes manually.

Access Control Mechanisms

Each access event is logged in detail, capturing:

  • Locker ID and slot ID.
  • User or agent ID.
  • Timestamp of access.
  • Result (success/failure).

The pickup code system serves as a secure, temporary credential.

  • Each code has a short time window and can only be used once.
  • Even if intercepted, expired codes are useless.

Locker Authentication

Every locker in the network must also authenticate with the backend.

  • During setup, lockers are assigned unique device certificates.
  • Only trusted lockers can communicate with the cloud services.
  • Heartbeat signals are used to verify that lockers remain active and uncompromised.

Physical and IoT Security

Because lockers are public-facing devices, they must be tamper-resistant.

  • Hardware components are sealed to prevent unauthorized access.
  • Intrusion detection sensors can report physical tampering attempts.
  • Firmware updates are signed and verified before installation.

Demonstrating your understanding of multi-layered security, physical, software, and data-level, in interviews shows that you think like a systems engineer, not just a software architect.

Scalability, Fault Tolerance, and Monitoring

Now let’s look at how the Amazon Locker System Design handles the challenges of operating at a global scale.

When a system spans millions of users and thousands of locker stations across multiple regions, scalability and fault tolerance are not just optional—they’re critical.

Scalability

To ensure smooth performance worldwide:

  • Horizontally scale APIs: Add more servers to handle increased requests.
  • Partition databases geographically: Reduce latency by keeping data near users.
  • Use caching layers: Cache frequently accessed data (locker availability, user preferences).
  • Load balance requests: Use reverse proxies to distribute traffic evenly across backend servers.

For example, when millions of packages are delivered during peak shopping seasons, the system dynamically scales based on demand.

Fault Tolerance

Failures can happen at any level—network outages, hardware failures, or software bugs. To mitigate these:

  • Use message queues (like Kafka) for asynchronous communication.
  • Retry failed tasks automatically with exponential backoff.
  • Replicate data across multiple data centers for high availability.
  • Implement checkpointing in processing pipelines so tasks resume smoothly after failures.

Lockers themselves also have fallback mechanisms:

  • If a locker loses connectivity, it temporarily switches to offline mode and syncs data once the network is back.

Monitoring and Observability

You can’t fix what you can’t see—that’s why monitoring is essential.

Track these key metrics:

  • Locker uptime and response latency.
  • Failed command rates.
  • Network latency and message delivery delays.
  • Power and temperature readings (for locker hardware health).

Use real-time dashboards to visualize performance and trigger alerts for anomalies.
Monitoring tools help operations teams prevent failures before they affect users, a critical aspect of any distributed System Design.

Interview Angle: Explaining Amazon Locker System Design

If you’re preparing for a System Design interview, the Amazon Locker System Design question is one of the best opportunities to demonstrate well-rounded thinking.

It tests your ability to combine distributed architecture, IoT communication, and user experience design into one cohesive solution.

How to Structure Your Answer

When presented with this question, follow a clear, structured approach:

  1. Clarify Requirements
    • Ask if the system should support global scale or a regional deployment.
    • Clarify whether lockers must function offline.
  2. Define Functional Scope
    • Locker assignment, package tracking, notifications, and pickup flow.
  3. Sketch the Architecture
    • Include components: API Gateway, Locker Management Service, IoT layer, Database, Notification Service.
  4. Discuss Key Challenges
    • IoT connectivity, real-time synchronization, and code security.
  5. Address Scalability and Fault Tolerance
    • Describe sharding, replication, and asynchronous message handling.
  6. Conclude with Trade-offs
    • Real-time updates vs eventual consistency.
    • Local caching vs centralized control.

Example Interview Summary

“I’d design the Amazon Locker system as a globally distributed IoT platform. Each locker communicates with cloud services via MQTT, supports offline mode with local caching, and synchronizes package data asynchronously. I’d prioritize scalability and security—encrypt all communications, use partitioned databases, and implement monitoring for real-time fault detection.”

Recommended Resource

To structure your interview answers effectively, explore Grokking the System Design Interview.
It breaks down real-world System Design questions like this into step-by-step thinking frameworks and helps you practice explaining trade-offs clearly.

You can also choose the best System Design study material based on your experience:

Lessons from Designing the Amazon Locker System

Designing the Amazon Locker system involves more than connecting hardware and software—it involves creating a seamless, secure, and scalable experience that bridges the digital and physical worlds.

You’ve now explored this system’s full lifecycle, from locker assignment to IoT communication, security, and fault tolerance.

Final Thoughts

If you can design the Amazon Locker system, you can handle most real-world distributed systems, from smart devices to logistics tracking to scalable consumer applications.

This problem teaches you to balance hardware realities with software flexibility, a skill that separates strong System Designers from average ones.

The next time you’re asked an IoT-based question in an interview, remember: start simple, build layer by layer, and always design for scale, security, and reliability.

Share with others

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Guides