← Amazon Web Services Interview Insights

Amazon Web Services·Software Engineer·Onsite - Multi Round·Intermediate

IntermediateRejected
Jul 2026

Summary

Went through the full AWS SDE II loop, two days of back-to-back interviews covering system design, two DSA rounds, and a bar raiser behavioral plus low-level design session. The OA was interesting because one part involved debugging an unfamiliar codebase with AI assistance rather than writing from scratch. Got rejected in the end, mainly for not communicating my thinking clearly enough.

Questions Asked (5)

Q1

Design a book marketplace that connects customers with multiple sellers, where a customer submits a purchase request with a maximum price and the system finds the best available deal.

System DesignTechnical Trade-offs
Author's notes

This was the one I bombed.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and defining the core entities (customers, sellers, books, listings), then design the data flow from purchase request submission through price matching to order fulfillment. Emphasize scalability, consistency trade-offs, and how AWS-native services can be leveraged to handle high throughput and fault tolerance.

Pro tip: Proactively discuss the CAP theorem trade-off in the context of inventory and pricing — specifically whether you prioritize consistency (avoiding overselling) or availability (always accepting requests), as this decision cascades into your entire architecture and signals senior-level thinking.

1. Clarify Requirements & Scale

Ask about expected read/write ratios, number of sellers, catalog size, and SLA expectations (e.g., latency for price matching). Confirm whether 'best deal' means lowest price, fastest delivery, or a combination of factors.

2. Define Core Entities & Data Model

Identify key entities: Book (ISBN, metadata), Seller, Listing (seller + book + price + inventory), and PurchaseRequest (customer, book, max_price). Design the schema to efficiently support price-range queries and inventory lookups.

3. Design the Price Matching Engine

Describe how incoming purchase requests are matched against available listings — for example, using a sorted index or priority queue on price per book ISBN filtered by max_price. Address how to handle concurrent requests to prevent race conditions and overselling using optimistic locking or atomic inventory decrements.

4. Define the System Architecture & Components

Outline the major services: an API Gateway for ingestion, a matching service (stateless, horizontally scalable), a listings/inventory store (e.g., DynamoDB with conditional writes), an order service, and an async notification layer (e.g., SQS/SNS for seller and customer updates). Mention caching (ElastiCache) for hot book listings.

5. Address Scalability, Reliability & Trade-offs

Discuss how the system handles traffic spikes (auto-scaling, queue-based buffering), failure scenarios (idempotent order creation, dead-letter queues), and monitoring (CloudWatch metrics on match rate, latency, failed transactions). Explicitly call out trade-offs made, such as eventual consistency in inventory counts vs. strong consistency.

Key Points to Mention

  • Optimistic locking or conditional writes (e.g., DynamoDB ConditionExpression) to prevent overselling when multiple customers compete for the same listing
  • Indexing strategy for efficient price-range queries — e.g., a Global Secondary Index on (ISBN, price) in DynamoDB or a sorted set in Redis
  • Asynchronous processing via SQS to decouple request ingestion from matching and order fulfillment, improving resilience under load
  • Idempotency keys on order creation to safely handle retries without duplicate purchases
  • Eventual vs. strong consistency trade-off: accepting slight inventory inaccuracies for higher availability vs. strict locking for correctness
  • Seller onboarding and listing management as a separate write path, with cache invalidation or TTL strategies to keep the matching engine's view fresh

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Find the median from a data stream (using heaps).

Algorithms & Data Structures
Author's notes

Knew this one.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Use two heaps — a max-heap for the lower half and a min-heap for the upper half of the data stream — to maintain a balanced partition where the median can be retrieved in O(1) time. Explain the invariant that the two heaps differ in size by at most one, and that every element in the max-heap is less than or equal to every element in the min-heap. Walk through the addNum and findMedian operations clearly, covering both even and odd total element counts.

Pro tip: Mention the trade-offs and potential follow-up constraints AWS interviewers love — such as handling very large streams with memory limits, or if the data has a known bounded range (where a bucket/counting sort approach could outperform heaps). This signals systems-level thinking beyond the textbook solution.

1. Clarify the Problem

Confirm that numbers arrive one at a time in a stream and the median must be retrievable at any point. Ask if there are constraints on memory, data range, or whether duplicates are allowed.

2. Explain the Two-Heap Design

Describe using a max-heap (lo) to store the smaller half and a min-heap (hi) to store the larger half, maintaining the invariant that |lo.size - hi.size| <= 1 and lo.top() <= hi.top().

3. Walk Through addNum Logic

Show the insertion logic: push to lo, then rebalance by moving lo's max to hi if needed, and if hi becomes larger than lo, move hi's min back to lo to maintain the size invariant.

4. Walk Through findMedian Logic

Explain that if both heaps are equal in size, the median is the average of both tops; if lo has one extra element, the median is lo's top — achieving O(1) retrieval.

5. Analyze Complexity and Trade-offs

State that addNum is O(log n) due to heap operations and findMedian is O(1), then briefly mention alternatives like order-statistics trees or sliding-window variants for follow-up scenarios.

Key Points to Mention

  • Max-heap for lower half, min-heap for upper half — and why this partition enables O(1) median access
  • The balancing invariant: heaps differ in size by at most one, and lo.top() <= hi.top() at all times
  • Step-by-step addNum rebalancing logic to maintain the invariant after each insertion
  • O(log n) time for insertion and O(1) time for median retrieval
  • Edge cases: single element in the stream, even vs. odd total counts, and duplicate values
  • Follow-up optimizations: bounded data range using bucket counting, or handling memory constraints in a distributed stream (relevant to AWS scale)

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q3

Given an array, find the length of the shortest subarray that, if sorted, would make the whole array sorted.

Algorithms & Data Structures
Author's notes

Two-pointer problem, medium difficulty.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by identifying the boundaries of the unsorted subarray by finding where elements deviate from sorted order from both ends. Then expand those boundaries outward to ensure all elements in the subarray are within the correct global min/max range, guaranteeing the full array becomes sorted after sorting just that subarray. Aim for an O(n) time and O(1) space solution to demonstrate optimal thinking.

Pro tip: Mention edge cases upfront — such as an already-sorted array (answer is 0) or a fully reversed array — to show defensive coding instincts that AWS values in production-grade systems. Also briefly acknowledge the naive O(n log n) approach before presenting the optimal O(n) solution to demonstrate your ability to iterate toward efficiency.

1. Clarify & State Examples

Confirm input constraints (e.g., duplicates allowed, negative numbers) and walk through a concrete example like [2, 6, 4, 8, 10, 9, 15] to ground your explanation. Identify the expected output (length 5, subarray [6,4,8,10,9]) before diving into the algorithm.

2. Find Initial Boundary Candidates

Scan left-to-right to find the last index where arr[i] > arr[i+1] (right boundary candidate), and right-to-left to find the last index where arr[i] < arr[i-1] (left boundary candidate). This gives a rough window of disorder.

3. Determine Min and Max of the Window

Find the minimum and maximum values within the candidate subarray window identified in step 2. These values are critical for correctly expanding the window boundaries.

4. Expand Boundaries to Correct Positions

Extend the left boundary leftward to include any elements greater than the window's minimum, and extend the right boundary rightward to include any elements smaller than the window's maximum. This ensures sorting the subarray will produce a globally sorted array.

5. Return Result & Discuss Complexity

Return right - left + 1 as the answer (or 0 if the array is already sorted). Explicitly state O(n) time complexity and O(1) space complexity, and mention how this compares to the O(n log n) sort-and-compare naive approach.

Key Points to Mention

  • Naive O(n log n) approach: compare original array with its sorted version to find differing indices, then compute the length between first and last mismatch.
  • Optimal O(n) approach: single-pass boundary detection using left-to-right and right-to-left scans without sorting.
  • Importance of expanding boundaries based on the subarray's min and max to handle cases where out-of-place elements exist outside the initial disorder window.
  • Edge case handling: already-sorted array returns 0, single-element array returns 0, fully reversed array returns n.
  • Space complexity trade-off: the O(n) approach achieves O(1) auxiliary space, which is important for large-scale data processing at AWS.
  • Duplicate elements: clarify that duplicates are handled correctly since boundary expansion uses strict comparisons against the subarray's min/max.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q4

Design the validation layer for an e-commerce order workflow, covering payment methods, delivery details, order info, and how to surface validation errors before passing the order downstream.

System DesignAPI & IntegrationsTechnical Trade-offs
Author's notes

This was the bar raiser round and the LLD portion caught me a bit off guard in terms of scope.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Frame your answer around a layered validation architecture that separates syntactic validation (schema/type checks) from semantic validation (business rules), and explain how each layer catches different classes of errors before the order reaches downstream services. Emphasize designing for extensibility and clear error contracts so that clients receive actionable, aggregated feedback rather than fail-fast single errors. Ground your design in real trade-offs like synchronous vs. asynchronous validation and centralized vs. distributed ownership.

Pro tip: At AWS scale, mention that validation logic should be treated as a first-class service boundary — consider exposing a dedicated Validation Service or using a pipeline/chain-of-responsibility pattern so individual validators can be independently deployed, tested, and toggled via feature flags without touching the core order workflow.

1. Define Validation Domains & Ownership

Break the order into distinct validation domains — payment methods, delivery details, and order info — and assign clear ownership (e.g., Payment Service validates card/wallet rules, Inventory Service validates item availability). This prevents tight coupling and lets each domain evolve its rules independently.

2. Layer Syntactic Then Semantic Validation

Apply syntactic validation first (required fields, data types, format constraints like postal codes or card numbers) using a schema validator (e.g., JSON Schema, Protobuf) at the API gateway or ingestion layer. Follow with semantic validation (sufficient funds, address deliverability, stock availability, promo code validity) which may require external service calls or DB lookups.

3. Design an Aggregated Error Response Contract

Rather than failing on the first error, collect all validation violations across domains and return a structured error payload with field-level error codes, human-readable messages, and severity levels (blocking vs. warning). Define a stable error schema (e.g., RFC 7807 Problem Details) so clients can programmatically handle and display errors.

4. Implement a Validation Pipeline with Circuit Breakers

Orchestrate validators in a chain-of-responsibility or pipeline pattern, running independent validators in parallel where possible (e.g., payment and address checks concurrently) to minimize latency. Add circuit breakers and fallback strategies for external validators (e.g., address verification APIs) so a third-party outage doesn't block all orders.

5. Gate Downstream Handoff & Observability

Only pass a fully validated, canonicalized order object to downstream services (fulfillment, inventory reservation) once all blocking validations pass, using an immutable order DTO or event. Instrument each validation step with metrics (error rates by type, latency) and structured logs to enable rapid debugging and SLA monitoring.

Key Points to Mention

  • Separation of syntactic vs. semantic validation layers and where each lives in the architecture (API gateway vs. service layer)
  • Aggregated vs. fail-fast error collection and designing a stable, structured error response contract (e.g., RFC 7807) with field-level detail
  • Parallel execution of independent validators to reduce end-to-end validation latency, with a defined timeout and fallback strategy
  • Idempotency and re-validation considerations — e.g., whether to re-validate on retry or cache validation results with a short TTL
  • Feature flags or rule engines (e.g., AWS AppConfig) to toggle validation rules without redeployment, supporting A/B testing of new business rules
  • Observability: emitting structured metrics and traces per validation domain to detect regressions, abuse patterns, or third-party degradation

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q5

OA: Given an existing codebase with failing unit tests, use AI assistance to identify why the tests are failing, locate the problematic code, and implement the fix.

Root Cause AnalysisAlgorithms & Data Structures
Author's notes

Genuinely interesting format.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by systematically reading the failing test cases to understand the expected behavior, then use AI assistance to trace the execution path and pinpoint discrepancies between expected and actual outputs. Once the root cause is identified, implement a minimal, targeted fix that resolves the failure without introducing regressions in passing tests.

Pro tip: At AWS, demonstrating operational excellence means not just fixing the bug but also explaining *why* it existed — mention edge cases, off-by-one errors, or incorrect assumptions in the original logic to show deep understanding rather than a surface-level patch.

1. Read and Understand the Failing Tests

Carefully examine each failing test case to extract the expected inputs, outputs, and invariants. This defines the contract the production code must satisfy and anchors your debugging effort.

2. Trace the Execution Path

Use AI assistance to walk through the relevant code paths triggered by the failing tests, identifying where actual behavior diverges from expected behavior. Look for incorrect logic, wrong data structure usage, or missed edge cases.

3. Identify the Root Cause

Pinpoint the exact line(s) or logic block responsible for the failure, distinguishing between symptoms and the underlying cause. Common culprits include off-by-one errors, incorrect base cases, wrong comparators, or mutated state.

4. Implement and Validate the Fix

Apply a minimal, targeted fix that directly addresses the root cause, then re-run all tests — both previously failing and passing — to confirm no regressions were introduced. Explain your reasoning for the chosen fix approach.

5. Communicate Findings Clearly

Summarize what the bug was, why it occurred, and how your fix resolves it, as if writing a code review comment or incident summary. This demonstrates engineering maturity and aligns with AWS's culture of written clarity.

Key Points to Mention

  • Reading test assertions first to define expected behavior before touching production code
  • Using AI tools to accelerate root cause analysis while maintaining critical human judgment over the suggested fix
  • Checking for common algorithmic pitfalls such as off-by-one errors, incorrect boundary conditions, or improper handling of empty/null inputs
  • Ensuring the fix is minimal and surgical to avoid unintended side effects on passing tests
  • Verifying time and space complexity of the corrected algorithm to confirm it meets performance requirements
  • Articulating the root cause clearly, distinguishing between the symptom (test failure) and the underlying logic error

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.