AWS Serverless and Microservices Interview Questions and Answers: Lambda, API Gateway, and EventBridge

Serverless architectures power modern event-driven applications on AWS. Here are key AWS Serverless interview questions and answers covering Lambda, API Gateway, SQS, SNS, and EventBridge.

1. What causes AWS Lambda cold starts, and how do you minimize them?

Answer: A cold start occurs when AWS initializes a new execution environment (downloading code, starting the runtime, and running initialization code outside the handler). You can minimize cold starts by keeping deployment packages small, using Provisioned Concurrency or Lambda SnapStart (for supported runtimes), and avoiding unnecessary VPC attachments unless needed for private resources.

2. How do Amazon SQS, SNS, and EventBridge differ?

Answer: Amazon SQS is a pull-based message queue for decoupling producers and consumers (1-to-1). Amazon SNS is a pub/sub push service for fanning out messages to many subscribers simultaneously. Amazon EventBridge is a serverless event bus that routes events based on content-filtering rules across AWS services, SaaS apps, and custom applications.

3. What is the difference between API Gateway REST APIs and HTTP APIs?

Answer: HTTP APIs are lightweight, lower-latency, and up to 70% cheaper, ideal for simple Lambda or HTTP proxy backends with JWT/OAuth2 auth. REST APIs offer advanced features like API keys, usage plans, request/response transformation, WAF integration, and edge-optimized endpoints.

4. When should you use AWS Step Functions instead of chaining Lambda functions directly?

Answer: Use AWS Step Functions for multi-step workflows that require retries, error handling, parallel branching, human approvals, or long-running orchestration (up to one year in Standard Workflows) without writing brittle glue code inside Lambda.

5. What is DynamoDB single-table design, and why is it used in serverless apps?

Answer: Single-table design stores multiple related entity types (such as Users, Orders, and Items) in one DynamoDB table using overloaded partition and sort keys. It enables fetching related data in a single low-latency query, reducing round trips and keeping serverless APIs fast and cost-effective.

Leave a Comment

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

Scroll to Top