AWS Solutions Architect exam prep

Episode 12: AWS Lambda & Serverless Architecture - Functions, API Gateway & Step Functions | SAA-C03

Complete serverless guide! Lambda, API Gateway, Step Functions, Cognito and 5 real architectures in 40 minutes.

🚀 SERVERLESS PARADIGM

No servers to manage. You write code, AWS handles infrastructure. Automatic scaling, pay only for actual use.

⚡ LAMBDA FUNDAMENTALS

CRITICAL LIMITS (exam tested):

• Max execution: 15 MINUTES (900 seconds) - hard limit!

• Memory: 128 MB - 10 GB (CPU scales with RAM)

• Concurrency: 1,000 simultaneous executions default

• Deployment: 50 MB compressed, 250 MB uncompressed

• /tmp storage: Ephemeral, doesn't persist!

PRICING: FREE tier 1M requests/month + 400K GB-seconds. Beyond: $0.20 per 1M requests. Example: 3M requests = $4.73/month vs $30-50 on EC2 (85% savings!)

COLD vs WARM STARTS: First invocation slower (100ms-few seconds), subsequent fast (<10ms). Provisioned Concurrency eliminates cold starts.

🔗 LAMBDA INTEGRATIONS

Triggers: API Gateway (REST APIs), S3 (file events), DynamoDB Streams (data changes), Kinesis (streaming), SNS/SQS (messaging), EventBridge (CRON jobs), ALB (HTTP), Cognito (auth).

Execution modes: Synchronous (caller waits), Asynchronous (fire-and-forget), Event source mapping (Lambda polls).

🌐 API GATEWAY

Create REST APIs backed by Lambda. Features: API versioning, multiple environments, authentication (IAM/Cognito/custom), throttling, caching, transformations.

Integrations: Lambda (most common), HTTP proxy (add auth/throttling), AWS services (direct Kinesis/SQS).

Endpoints: Edge-Optimized (CloudFront global), Regional (same region), Private (VPC only).

CRITICAL: 29-second timeout! Lambda runs 15 min but API Gateway times out at 29 sec.

🔄 STEP FUNCTIONS

Orchestrate multiple Lambdas into workflows. Visual state machines with sequence, parallel, choice, wait states, error handling with automatic retries.

Standard workflows (up to 1 year, exactly-once). Express workflows (5 min, at-least-once, cheaper).

Use cases: Order fulfillment, ETL pipelines, human approval, multi-step business logic.

👤 COGNITO

User Pools: Serverless user database. Sign-up/in, password reset, MFA, social login (Facebook/Google/SAML). Integrates with API Gateway/ALB for JWT validation.

Identity Pools: Temporary AWS credentials for direct S3/DynamoDB access from mobile/web apps.

EXAM KEY: Cognito for mobile/web users. IAM for services. Keywords "mobile users" "Facebook login" = Cognito!

🏗️ 5 REAL ARCHITECTURES

1. REST API: API Gateway + Lambda + DynamoDB + Cognito

2. Thumbnail Service: S3 → Lambda → S3 + DynamoDB (thousands/sec)

3. CRON Jobs: EventBridge → Lambda → SNS ($0.50/month vs $30 EC2)

4. Data Pipeline: Kinesis → Lambda → Firehose → S3 (millions/day)

5. Mobile Backend: Cognito + API Gateway + Lambda + S3 + DynamoDB

⚠️ 12 CRITICAL EXAM TRAPS

1. Lambda max 15 MIN (longer = EC2/Batch/ECS)

2. Cold starts exist (Provisioned Concurrency eliminates)

3. Concurrency 1,000 default (request increases)

4. Lambda in VPC slower cold starts

5. API Gateway 29-SEC timeout (async for longer)

6. /tmp EPHEMERAL (S3/EFS for persistence)

7. Deployment 250 MB limit (use Layers)

8. DynamoDB Streams prerequisite for Global Tables

9. Cognito for users, IAM for services

10. Step Functions for orchestration (not manual chaining)

11. ALB can invoke Lambda (target group)

12. Environment variables 4 KB (Parameter Store for more)

⏱️ TIMESTAMPS

00:00 Introduction | 01:00 Serverless Paradigm | 03:00 Lambda Fundamentals | 08:00 Lambda Triggers | 12:00 API Gateway | 16:00 Step Functions | 19:00 Cognito | 22:00 5 Architectures | 29:00 12 Exam Traps | 36:00 Tips | 38:30 Conclusion

Perfect for SAA-C03 exam and understanding event-driven serverless!

#AWS #Lambda #Serverless #APIGateway #StepFunctions #Cognito #SAAC03

⭐ 5-star rating if this helps!

🔗 docs.aws.amazon.com/lambda