Amazon Interview Questions (43+ Questions)

Last Updated: June 8, 2026 • 43 QuestionsReal Company Interviews

Prepare for your Amazon interview with our comprehensive collection of 43+ real interview questions and detailed answers. These questions have been curated from actual Amazon technical interviews across various roles including DevOps Engineer, Data Engineer, QA Engineer, and more.

43
Interview Questions
1
Categories
3
Difficulty Levels

Table of Contents

Our Amazon interview questions cover a wide range of technical topics and difficulty levels, from entry-level positions to senior roles. Each question includes detailed explanations and answers to help you understand the concepts and prepare effectively for your interview.

💡 Pro Tips for Amazon Interviews

  • Practice each question and understand the underlying concepts
  • Review Amazon's specific technologies and methodologies
  • Prepare follow-up questions and edge cases
  • Practice explaining your solutions clearly and concisely

Interview Questions & Answers

1. Performance-Based Backend Selection

Company: Amazon Difficulty: easy 🔒 Premium Categories: Devops

Learn how to measure disk write performance and select appropriate storage backends using Linux Bash commands. This guide covers benchmarking sequential write speeds, interpreting results, and making data-driven infrastructure decisions, essential for matching storage solutions to application requirements and ensuring performance in data-intensive workloads.

2. Handling Large Log Archives

Company: Amazon Difficulty: easy Categories: Devops

Learn how to split large log files into manageable chunks using Linux Bash commands. This guide covers breaking gigabyte-sized logs into smaller files with sequential naming, preserving the original file, and verifying the split process, essential for parallel log analysis, incident investigation, and handling massive logs in DevOps environments.

3. Container With Most Water

Company: Amazon Difficulty: medium Categories: Devops, Data engineering, Quality assurance

def max_area(height: list[int]) -> int:
l, r = 0, len(height) - 1
res = 0

while l < r:
    area = (r - l) * min(height[l], height[r])
    res = max(res, area)
    
    if height[l] < height[r]:
        l += 1
    else:
        r -= 1
        
return res

4. Extract and Normalize Timestamps from Multi-Format Log File

Company: Amazon Difficulty: medium Categories: Devops, Data engineering, Quality assurance

Use regular expressions to extract timestamps from log entries in various formats (ISO 8601, Apache, RFC 2822), parse them using Python datetime, and convert all timestamps to a uniform ISO 8601 format.

5. Merge k Sorted Lists

Company: Amazon Difficulty: hard Categories: Devops, Data engineering

Definition for singly-linked list.

class ListNode:

def init(self, val=0, next=None):

self.val = val

self.next = next

def merge_k_lists(lists: list[Optional[ListNode]]) -> Optional[ListNode]:
min_heap = []

for i, l in enumerate(lists):
    if l:
        heapq.heappush(min_heap, (l.val, i, l))
        
dummy = ListNode(0)
tail = dummy

while min_heap:
    val, i, node = heapq.heappop(min_heap)
    tail.next = node
    tail = tail.next
    
    if node.next:
        heapq.heappush(min_heap, (node.next.val, i, node.next))
        
return dummy.next

6. Configure AWS IAM Password Policy

Company: Amazon Difficulty: easy 🔒 Premium Categories: Devops

Set up an AWS account-wide IAM password policy to enforce minimum length, character requirements, and prevent password reuse using AWS CLI.

7. Walls and Gates

Company: Amazon Difficulty: medium Categories: Devops, Data engineering

def walls_and_gates(rooms: list[list[int]]) -> list[list[int]]:
if not rooms or not rooms[0]:
return rooms

rows, cols = len(rooms), len(rooms[0])
q = deque()
INF = 2147483647

for r in range(rows):
    for c in range(cols):
        if rooms[r][c] == 0:
            q.append((r, c))
            
directions = [[1, 0], [-1, 0], [0, 1], [0, -1]]

while q:
    r, c = q.popleft()
    
    for dr, dc in directions:
        nr, nc = r + dr, c + dc
        if 0 <= nr < rows and 0 <= nc < cols and rooms[nr][nc] == INF:
            rooms[nr][nc] = rooms[r][c] + 1
            q.append((nr, nc))
            
return rooms

8. Audit and Enforce Least-Privilege IAM Permissions

Company: Amazon Difficulty: easy Categories: Devops

Audit an IAM user with overly broad permissions, identify attached policies, and replace them with a least-privilege custom policy scoped to only the services the user actually needs.

9. Create an ECR Repository with Security and Cross-Account Access

Company: Amazon Difficulty: medium 🔒 Premium Categories: Devops

Create an ECR repository with tag immutability, a lifecycle policy to expire old untagged images, and a repository policy granting cross-account pull access.

10. Build a Serverless API with Lambda, API Gateway, and DynamoDB

Company: Amazon Difficulty: hard Categories: Devops

Create a serverless API using AWS Lambda and API Gateway that stores and retrieves data from a DynamoDB table, with a least-privilege IAM execution role and no direct database exposure.

11. Deploy a Highly Available ECS Application with RDS

Company: Amazon Difficulty: hard 🔒 Premium Categories: Devops

Deploy a highly available containerized application on ECS Fargate with RDS, ALB, ECR, and Secrets Manager across multiple Availability Zones with proper network isolation and security groups.

12. Event-Driven Order Processing with EventBridge Fan-Out

Company: Amazon Difficulty: hard 🔒 Premium Categories: Devops

Build an event-driven architecture using EventBridge, SQS, SNS, and CloudWatch to fan out order events to multiple independent consumers with dead-letter handling and least-privilege access.

13. Blue/Green Deployment with ALB Weighted Target Groups

Company: Amazon Difficulty: hard 🔒 Premium Categories: Devops

Implement a blue/green deployment strategy using Auto Scaling Groups, ALB weighted target groups, launch templates, and Secrets Manager for zero-downtime deployments with instant rollback capability.

14. Cross-VPC Connectivity for ECS and RDS

Company: Amazon Difficulty: hard 🔒 Premium Categories: Devops

Configure secure cross-VPC connectivity using VPC Peering so that an ECS Fargate application in one VPC can access a private RDS database in another VPC with proper routing, DNS resolution, and security group controls.

15. Architect a Segregated Multi VPC Network with Centralized Routing

Company: Amazon Difficulty: hard Categories: Devops

Test your enterprise networking skills by designing a secure, hub-and-spoke AWS Transit Gateway architecture with strict traffic segmentation and centralized VPC Flow Logs.

16. Monthly Hiring Trend by Department

Company: Amazon Difficulty: easy 🔒 Premium Categories: Data analysis, Data engineering

Mastering the Interview Question:

Counting Employee Hires per Month by Department in SQL

Objective

To tackle this SQL interview question, we're given two tables: employees and departments. Our goal is to determine the number of employees hired each month for every department.

E...


🔒 Premium Content

Detailed explanation and solution available for premium members.

Upgrade to Premium →

17. Ranking with Dense_Rank

Company: Amazon Difficulty: medium Categories: Data analysis, Data engineering

SEO-Friendly Explanation: SQL Interview Question on Sales Rankings

If you're preparing for a SQL interview, understanding how to compute rankings based on aggregated data is essential. One common question you might encounter involves computing total sales for each salesperson and ranking them accordingly using SQL. Below you will find a detailed explanation of how to tackle such a question, making sure your solution is both efficient and adheres to best practices.

Objective

Your task is to write a SQL query that computes total sales for each salesperson from a table named sales and assigns a dense rank based on these totals in descending order. Salespeople with identical total sales should receive the same rank, and there should be no gaps in the sequence.

Additional Information

Table Schema:

  • sales:
    • salesperson_id (INTEGER): Unique identifier for each salesperson.
    • salesperson_name (VARCHAR): Name of the salesperson.
    • sale_amount (INTEGER): Amount of an individual sale.

Constraints:

  • The sales table contains at least one record.
  • Total sales for each salesperson are calculated as the sum of their sale_amount values.
  • Utilize SQL window functions to determine the sales rankings.

Output Requirements:

  • Columns to return:
    • salesperson_name: Name of the salesperson.
    • total_sales: Sum of all sales amounts for the salesperson.
    • sales_rank: Dense rank based on total_sales in descending order.
  • Order the results first by sales_rank in ascending order, then by salesperson_name in ascending order.

SQL Query Solution

Here is the SQL query to achieve the objective:

SELECT
    salesperson_name,
    total_sales,
    DENSE_RANK() OVER (ORDER BY total_sales DESC) AS sales_rank
FROM
    (
        SELECT
            salesperson_id,
            salesperson_name,
            SUM(sale_amount) AS total_sales
        FROM
            sales
        GROUP BY
            salesperson_id,
            salesperson_name
    ) AS sales_summary
ORDER BY
    sales_rank ASC,
    salesperson_name ASC;

Explanation of the SQL Query

  • Subquery (sales_summary): First, we use a subquery to compute the total sales for each salesperson. We do this by selecting salesperson_id, salesperson_name, and the SUM(sale_amount) grouped by salesperson_id and salesperson_name.
  • Main Query: In the main query, we select salesperson_name and total_sales from the subquery. We also compute the sales_rank using the DENSE_RANK() window function, ordering by total_sales in descending order.
  • Order By Clause: Finally, we order the entire result set by sales_rank in ascending order, and then by salesperson_name in ascending order to meet the output requirements.

This query ensures a seamless ranking sequence with no gaps, even when multiple salespeople have the same total sales amount. By summarizing sales and computing ranks in a single query, you can efficiently generate the required output while showcasing your SQL proficiency in an interview setting.

18. Combine Aggregates with UNION ALL

Company: Amazon Difficulty: easy 🔒 Premium Categories: Data analysis, Data engineering

How to Tackle the SQL Interview Question: Summarize Online and Offline Orders

When interviewing for a position that involves working with SQL, one common question you might encounter is:

Objective

Create a SQL query that retrieves a summary of orders from two separate sources: online and ...


🔒 Premium Content

Detailed explanation and solution available for premium members.

Upgrade to Premium →

19. Advanced JOIN with Three Tables

Company: Amazon Difficulty: easy 🔒 Premium Categories: Data analysis, Data engineering

Objective

Write an SQL query that retrieves the customer name, order date, payment amount, and payment date for all payments greater than $1000. The results should be sorted in descending order of payment amount and, for payments with the same amount, by ascending order date.

Additional inf...


🔒 Premium Content

Detailed explanation and solution available for premium members.

Upgrade to Premium →

20. Flatten Nested JSON to CSV with Dot-Notation Columns

Company: Amazon Difficulty: medium Categories: Data analysis, Data engineering

Convert nested JSON objects to flat CSV format using dot-notation for nested fields and comma-separated strings for arrays with pandas in Python.

21. Count Daily Customers and Total Call Duration

Company: Amazon Difficulty: easy Categories: Data analysis, Data engineering

SELECT
date,
COUNT(DISTINCT cust_id) AS num_customers,
SUM(duration) AS total_duration
FROM {{ ref("calls") }}
GROUP BY date

22. Numeric Age from Rock Sample

Company: Amazon Difficulty: easy Categories: Data analysis, Data engineering

SELECT
sample_id,
description,
COALESCE(REGEXP_SUBSTR(description, '[0-9]+'), '') AS age
FROM {{ ref("rock_samples") }}

23. Category Stats

Company: Amazon Difficulty: medium Categories: Data analysis, Data engineering

Join products with orders and compute per-category average price and order count.

24. Product Summary

Company: Amazon Difficulty: medium Categories: Data analysis, Data engineering

Combine product, sales, and inventory data using left joins with null handling.

25. Global & Domain SEO Leaders

Company: Amazon Difficulty: hard Categories: Data analysis, Data engineering

Master advanced PySpark Window functions by calculating both partition-level and global maximums. Learn how to use empty window partitions and conditional F.when() logic to identify top-performing SEO pages.

26. Factory Data Cleanup

Company: Amazon Difficulty: medium Categories: Data analysis, Data engineering

Practice cleaning and merging manufacturing data in PySpark. Learn how to remove exact duplicate rows using dropDuplicates() before joining multiple DataFrames together.

27. Average Height Per Floor

Company: Amazon Difficulty: easy Categories: Data analysis, Data engineering

SELECT
id,
name,
city,
country,
CASE
WHEN floors != 0
THEN ROUND(height_m / floors, 2)
ELSE 0
END AS avg_height_per_floor
FROM {{ ref("buildings") }}

28. Product Reorder Suggestion Query

Company: Amazon Difficulty: medium 🔒 Premium Categories: Data analysis, Data engineering

Identifying Products for Reorder in Inventory Using SQL

Objective

In this task, you'll write an SQL query to identify products in the inventory that need to be reordered. For each product that requires reordering, you'll calculate the suggested order quantity with the formula: `CEIL((reorder...


🔒 Premium Content

Detailed explanation and solution available for premium members.

Upgrade to Premium →

29. LFU Cache

Company: Amazon Difficulty: hard Categories: Data engineering

from collections import defaultdict, OrderedDict

class LFUCache:
def init(self, capacity):
self.cap = capacity
self.min_freq = 0
self.key_val = {}
self.key_freq = {}
self.freq_keys = defaultdict(OrderedDict)

def _update(self, key):
    freq = self.key_freq[key]
    self.freq_keys[freq].pop(key)
    if not self.freq_keys[freq] and self.min_freq == freq:
        self.min_freq += 1
    self.key_freq[key] = freq + 1
    self.freq_keys[freq + 1][key] = None

def get(self, key):
    if key not in self.key_val:
        return -1
    self._update(key)
    return self.key_val[key]

def put(self, key, value):
    if self.cap <= 0:
        return
    if key in self.key_val:
        self.key_val[key] = value
        self._update(key)
        return
    if len(self.key_val) >= self.cap:
        evict_key, _ = self.freq_keys[self.min_freq].popitem(last=False)
        del self.key_val[evict_key]
        del self.key_freq[evict_key]
    self.key_val[key] = value
    self.key_freq[key] = 1
    self.freq_keys[1][key] = None
    self.min_freq = 1

30. Moving Average from Data Stream

Company: Amazon Difficulty: easy Categories: Data engineering

from collections import deque

class MovingAverage:
def init(self, size):
self.size = size
self.queue = deque()
self.window_sum = 0

def next(self, val):
    self.queue.append(val)
    self.window_sum += val
    if len(self.queue) > self.size:
        self.window_sum -= self.queue.popleft()
    return self.window_sum / len(self.queue)

31. Return Rate Comparison across Categories

Company: Amazon Difficulty: medium 🔒 Premium Categories: Data engineering

How to Calculate the Return Rate of Orders for Each Product Category Using SQL

Objective

In a SQL interview, you might encounter a challenging yet intriguing question: Write a SQL query to calculate the return rate of orders for each product category. The return rate is defined as the per...


🔒 Premium Content

Detailed explanation and solution available for premium members.

Upgrade to Premium →

32. Average Review Ratings

Company: Amazon Difficulty: easy Categories: Data engineering

SELECT
DATE_TRUNC('month', review_date) AS review_month,
product_id,
ROUND(AVG(star_rating)) AS avg_rating
FROM
product_reviews
GROUP BY
DATE_TRUNC('month', review_date),
product_id
ORDER BY
review_month ASC,
product_id ASC;

33. Order Items Average

Company: Amazon Difficulty: easy Categories: Data engineering

SELECT
ROUND(
SUM(item_count * order_occurrences)::DECIMAL / SUM(order_occurrences),
1
) AS mean_items
FROM
items_per_order;

34. Active Customer Analysis

Company: Amazon Difficulty: easy Categories: Data engineering

SELECT
COUNT(policy_holder_id) AS policy_holder_count
FROM
(
SELECT
policy_holder_id,
COUNT(case_id) AS call_count
FROM
callers
GROUP BY
policy_holder_id
HAVING
COUNT(case_id) >= 3
) AS frequent_callers;

35. Employee Salary Ranking Analysis

Company: Amazon Difficulty: medium Categories: Data engineering

SELECT
MAX(salary) AS second_highest_salary
FROM
employee
WHERE
salary < (
SELECT
MAX(salary)
FROM
employee
);

36. Highest-Grossing Items

Company: Amazon Difficulty: medium Categories: Data engineering

SELECT
category,
product,
total_spend
FROM
(
SELECT
category,
product,
SUM(spend) AS total_spend,
RANK() OVER (
PARTITION BY
category
ORDER BY
SUM(spend) DESC
) AS ranking
FROM
product_spend
WHERE
EXTRACT(
YEAR
FROM
transaction_date
) = 2022
GROUP BY
category,
product
) AS ranked_products
WHERE
ranking <= 2
ORDER BY
category,
total_spend DESC;

37. Complete Category Buyers

Company: Amazon Difficulty: medium Categories: Data engineering

SELECT
cp.customer_id
FROM
customer_purchases cp
JOIN product_catalog pc ON cp.product_id = pc.product_id
GROUP BY
cp.customer_id
HAVING
COUNT(DISTINCT pc.category) = (
SELECT
COUNT(DISTINCT category)
FROM
product_catalog
)
ORDER BY
cp.customer_id;

38. Prime Batch Warehouse Capacity

Company: Amazon Difficulty: hard Categories: Data engineering

WITH
summary AS (
SELECT
item_type,
SUM(item_count) AS batch_count,
SUM(square_footage * item_count) AS total_sqft
FROM
inventory
GROUP BY
item_type
)
SELECT
item_type,
CASE
WHEN item_type = 'prime_eligible' THEN batch_count
ELSE FLOOR(
(
500000 - (
SELECT
total_sqft
FROM
summary
WHERE
item_type = 'prime_eligible'
)
) * batch_count::DECIMAL / total_sqft
)
END AS max_batch_count
FROM
summary
ORDER BY
item_type DESC;

39. Senior Manager Direct Reports

Company: Amazon Difficulty: hard Categories: Data engineering

WITH
managers AS (
SELECT DISTINCT
manager_id AS employee_id
FROM
employees
WHERE
manager_id IS NOT NULL
),
manages_managers AS (
SELECT DISTINCT
e.manager_id AS employee_id
FROM
employees e
JOIN managers m ON e.employee_id = m.employee_id
WHERE
e.manager_id IS NOT NULL
)
SELECT
mgr.employee_name AS senior_manager_name,
COUNT(*) AS direct_report_count
FROM
manages_managers mm
JOIN employees mgr ON mm.employee_id = mgr.employee_id
JOIN employees e ON e.manager_id = mm.employee_id
WHERE
NOT EXISTS (
SELECT
1
FROM
employees sub
JOIN manages_managers mm2 ON sub.employee_id = mm2.employee_id
WHERE
sub.manager_id = mm.employee_id
)
GROUP BY
mgr.employee_name
ORDER BY
direct_report_count DESC,
senior_manager_name;

40. Server Fleet Uptime

Company: Amazon Difficulty: hard Categories: Data engineering

WITH
sessions AS (
SELECT
server_id,
status_time,
session_status,
LEAD(status_time) OVER (
PARTITION BY
server_id
ORDER BY
status_time
) AS stop_time
FROM
server_utilization
)
SELECT
FLOOR(
SUM(
EXTRACT(
EPOCH
FROM
(stop_time - status_time)
)
) / 86400
)::INT AS total_uptime_days
FROM
sessions
WHERE
session_status = 'start';

41. Promotional Campaign Effectiveness

Company: Amazon Difficulty: medium 🔒 Premium Categories: Data engineering

Understanding the SQL Query to Identify High-Impact Promotional Campaigns

When tackling an interview question about SQL queries for identifying influential promotional campaigns, there are several key components you need to consider.

Objective

Your task is to write a SQL query that identi...


🔒 Premium Content

Detailed explanation and solution available for premium members.

Upgrade to Premium →

42. Device Ecosystem API Testing

Company: Amazon Difficulty: medium 🔒 Premium Categories: Quality assurance

Apple's ecosystem connects over 2 billion active devices worldwide across iPhone, iPad, Mac, Apple Watch, and Apple TV. QA testing of Apple device ecosystem APIs requires comprehensive validation of device registration, sync services, iCloud backup management, and cross-platform data sharing to ensu...


🔒 Premium Content

Detailed explanation and solution available for premium members.

Upgrade to Premium →

43. Button Click Testing

Company: Amazon Difficulty: easy 🔒 Premium Categories: Quality assurance

Master simple button click testing with Selenium. Learn basic element interaction and click verification for beginners....


🔒 Premium Content

Detailed explanation and solution available for premium members.

Upgrade to Premium →


Ready to Practice More?

Explore interview questions from other companies or try our hands-on labs to build practical experience.