Amazon Interview Questions
Key components : S3 : cheap, durable object storage — organize as s3://bucket/layer/table/year=2024/month=01/ Glue Catalog : Hive compatible metastore —...
Outline a data lake architecture using S3, Glue, and Athena.
Key components : S3 : cheap, durable object storage — organize as s3://bucket/layer/table/year=2024/month=01/ Glue Catalog : Hive compatible metastore — stores table schemas and partition metadata; Athena uses it to know where data lives Glue ETL : PySpark based serverless jobs for transformation; auto scales without cluster management Athena : serverless SQL on S3 — charges per TB scanned; use Parquet + partitioning to minimize cost Lake Formation : permission layer on top — fine grained access
Design real-time analytics using Kinesis or Kafka streaming.
Kinesis architecture : Kafka alternative (MSK — Managed Streaming for Kafka): When to use which : Kinesis : fully managed, tight AWS integration, easier ops — good for AWS native shops Kafka (MSK) : higher throughput, richer ecosystem (Kafka Connect, Kafka Streams), better for multi cloud Key concerns : shard count in Kinesis (1 MB/s per shard), consumer lag monitoring via CloudWatch, checkpoint management for exactly once delivery.
Handle schema evolution in Glue catalog datasets.
Additive changes (new columns): safe — Parquet is self describing. Athena queries return NULL for the new column in older files. Breaking changes (renamed/dropped columns): 1. Write new data to a versioned path ( v2/orders/ ) 2. Create a new Glue table pointing to v2/ path 3. Migrate Athena views and downstream jobs to new table 4. Deprecate old table after consumers migrate Schema drift handling : Glue DynamicFrame's resolveChoice handles type conflicts (e.g., a column with mixed int/string val
Optimize Redshift queries for large datasets.
Distribution style : choose based on query patterns DISTKEY(customer id) : hash distribute on join key — collocates matching rows on same node DISTSTYLE ALL : replicate small dimension tables to every node DISTSTYLE EVEN : default; even distribution but requires shuffle on joins Sort keys : SORTKEY(date) : range queries on date skip unsorted blocks INTERLEAVED SORTKEY(date, region) : multi column filters benefit equally from any column Maintenance : VACUUM FULL table — reclaims space from delete
Design a CDC system using Lambda and Kinesis.
Event format (DMS → Kinesis): Lambda processing : Parse operation (insert/update/delete) For delete : soft delete or remove from target For insert/update : upsert into target (DynamoDB put item , or batch to S3 for Redshift MERGE ) Alternatives : Debezium (self managed): reads PostgreSQL WAL → Kafka → more flexibility AWS Glue Streaming : micro batch CDC from Kinesis into S3 Key concern : ordering — Kinesis is ordered per partition key; use order id as partition key to guarantee ordered updates
Use S3 partitioning and file formats for performance.
Partitioning strategy : Athena/Glue uses Hive style partitions — queries with WHERE year=2024 AND month=01 skip all other partitions. Partition granularity : daily is usually right. Hourly creates too many small files; monthly causes too much data per scan on date range queries. File format recommendations : Parquet + Snappy : best for analytics — columnar, splittable, ~5x compression Parquet + ZSTD : better compression ratio when storage cost is priority Avro : use for Kinesis/Kafka ingestion (
Manage scheduler and orchestration via Step Functions or Airflow.
Step Functions (AWS native): State machine for orchestrating AWS services (Glue, Lambda, ECS, EMR) Visual workflow; built in retry + error handling per state Good for event driven pipelines triggered by S3 events or API calls Limited Python logic — best for AWS service orchestration Airflow (MWAA — Managed Workflows for Apache Airflow) : Python defined DAGs — full programming flexibility Hundreds of operators (S3, Glue, Redshift, BigQuery, Spark, etc.) Backfill support, SLA monitoring, rich UI B
Build cost-cutting strategies for Spark on EMR.
Spot instances : use for task nodes (not master/core) — 60 80% cost savings. Configure with Spot interruption handling (checkpoint before spot reclaim) Instance fleet : mix instance types to improve Spot availability Auto scaling : scale task nodes based on YARN memory pressure — scale down when idle Right size : profile jobs first (Spark History Server) — don't over provision Transient clusters : spin up cluster per job, terminate after completion — avoid idle master node cost Storage optimized