VISI

Serverless Technologies

AWS Lambda — Key Facts:

  • Run code without servers. Scales automatically.
  • Memory: 128 MB – 10 GB (in 1 MB increments)
  • Max execution time: 900 seconds (15 minutes)
  • Disk (/tmp): 512 MB – 10 GB
  • Concurrency limit: 1,000 concurrent executions per region (can increase via support ticket)
  • Deployment package: 50 MB (compressed zip), 250 MB (uncompressed)
  • Environment variables: 4 KB
  • Pay: per request + per duration (GB-seconds). First 1M requests free; 400,000 GB-seconds free/month.

Lambda Concurrency & Throttling: If over the limit, synchronous invocations get 429 ThrottleError. Async invocations retry and go to DLQ. Use Reserved Concurrency to limit a function's concurrency (protects other functions).

Cold Start: New instance = code loaded + init code runs outside handler. Can have higher latency. Provisioned Concurrency keeps instances warm (no cold starts). SnapStart (Java, Python, .NET) takes a memory snapshot of initialized function for faster startup.

Lambda in VPC: Lambda in VPC: Must specify VPC, subnets, security groups. Lambda creates an ENI. Access private RDS, ElastiCache, etc. For RDS, use RDS Proxy to pool connections (reduces connection overhead, reduces failover time by 66%).

FeatureCloudFront FunctionsLambda@Edge
RuntimeJavaScriptNode.js, Python
TriggersViewer Request/Response onlyAll 4 (Viewer + Origin)
Max exec time< 1 ms5-10 seconds
Max memory2 MB128 MB – 10 GB
Network/File accessNoYes
PricingCheaper (1/6th of @Edge)No free tier

CloudFront Functions: Use for lightweight

CloudFront Functions use cases: Cache key normalization, header manipulation, URL rewrites, JWT validation. Lambda@Edge use cases: Lambda@Edge: Use for complex longer execution, 3rd-party library access, network access, file system, request body access.

Amazon API Gateway:

  • Supports REST API, HTTP API, WebSocket API.
  • Endpoint types: Edge-optimized (default, routed through CloudFront PoPs), Regional (same-region clients), Private (VPC only via ENI).
  • Security: IAM roles (internal apps), Cognito (external/mobile users), Custom Authorizer (Lambda).
  • Features: versioning, staging, throttling, caching, API keys, Swagger/OpenAPI import, SDK generation.
  • Edge-optimized cert must be in us-east-1. Regional cert must match API region.

References

Study tools

Mark this unit complete when you finish it.