Interview Questions
AWS Interview Questions Q: What is the difference between horizontal and vertical scaling? Vertical scaling (scale up) — add more resources to the same instance…
AWS Interview Questions
Q: What is the difference between horizontal and vertical scaling?
Vertical scaling (scale up) — add more resources to the same instance (bigger EC2 instance). Has limits and usually requires downtime. Horizontal scaling (scale out) — add more instances. AWS Auto Scaling, ECS, and Kubernetes do this automatically. Horizontal scaling is preferred for availability and fault tolerance.
Q: What is the difference between SQS and SNS?
SQS (queue) — a single consumer pulls messages; messages persist until processed; used for decoupling and work distribution. SNS (pub/sub) — pushes to multiple subscribers simultaneously (Lambda, SQS, HTTP, email); no persistence. Common pattern: SNS topic → multiple SQS queues (fan-out) so each subscriber processes independently.
Q: What are availability zones and regions?
A Region is a geographic area (us-east-1, eu-west-1) containing multiple Availability Zones (AZs). An AZ is one or more discrete data centers with redundant power, networking, and connectivity. AZs within a region are physically separated but connected with low-latency fiber. Deploy across multiple AZs for high availability; multiple regions for disaster recovery.
Q: What is IAM and how does it work?
Identity and Access Management controls who (authentication) can do what (authorization) in AWS. Core concepts: Users (humans/apps with long-term credentials), Groups (users with shared permissions), Roles (temporary credentials assumed by services, Lambda, EC2, CI/CD), Policies (JSON documents defining allowed/denied actions on resources). Best practice: never use root account, use roles for services, apply least privilege.
Q: What is the difference between Lambda and EC2?
EC2 is a managed VM — you control the OS, runtime, scaling. Always-on, charged per hour. Lambda is serverless — you provide only the function code. AWS handles infrastructure, scaling (to thousands of concurrent invocations), and you pay only per invocation + duration. Lambda cold starts can add latency (100ms-2s); not suitable for long-running or memory-intensive workloads (15-min limit, 10GB RAM max).
Q: What is a VPC and why is it important?
A Virtual Private Cloud is your isolated section of AWS. Public subnets have internet access via an Internet Gateway; private subnets don't (use NAT Gateway for outbound). Security Groups (stateful firewall per resource) and NACLs (stateless per subnet) control traffic. Keep databases in private subnets, load balancers in public subnets.