This presentation delves into the benefits and constraints of opting for Docker containers over traditional packaging when deploying Lambda code. Exploring runtime options, custom binaries, and performance implications, participants will grasp the various factors to weigh before embracing this deplo...
This presentation delves into the benefits and constraints of opting for Docker containers over traditional packaging when deploying Lambda code. Exploring runtime options, custom binaries, and performance implications, participants will grasp the various factors to weigh before embracing this deployment approach. Additionally, we'll discuss alternative strategies and mitigation methods to tackle the operational hurdles and downsides linked with containerized Lambdas. By the conclusion, attendees will have a solid grasp on when and how to best utilize Lambda containers, equipping them with the confidence to navigate decision-making in this domain.
Size: 11.91 MB
Language: en
Added: Jun 07, 2024
Slides: 12 pages
Slide Content
C ontainer-based Lambdas Weighing the Pros and Cons of containers in Lambda deployments
Agenda ‹#› Traditional deployment Limitations Container-based deployment Benefits Downsides Other alternatives | Samuel Durand - Should you use container-based Lambda functions? Use Cases (-> Gen AI 😄 )
Traditional Packaging ‹#› Zip the code Deploy via Sam, CDK, … Run it with AWS Lambda on Firecraker MicroVMs Advantages: low management overhead full features of Lambda layers and extensions
Traditional Downsides ‹#› Limited runtimes available NodeJS, Python, Java, .NET, Ruby, Go (kinda) Only specific versions available Upgrading too late can result in CF deadlock on deployment No control on MicroVM content -> legal concerns Limited package and dependencies size -> especially for ML / Generative AI 50 Mb for the package with layers 250Mb when decompressed for the Lambda + Layers
Container-based deployment ‹#› Package the code Choose a base image with runtimes included with Lambda components only any compatible docker image Write a Dockerfile Build & push to ECR Deploy the code to Lambda
Benefits ‹#› Flexibility : any runtime or binaries, and most OS Size: 10Gb size limit on package, dependencies or dataset Full control: full content known Performance : cold starts can be faster for NodeJS and Python depending on function size
Downsides ‹#› Operational overhead: build and maintenance more complex Lambda layers: deployment required for all version changes Cold start: larger size means slower cold start (Knowledge: build and optimize Docker images)
Alternatives ‹#› Runtime unavailable: use a Runtime Lambda layer Custom binaries: use a Lambda layer Large dataset: use EFS Larger than 50Mb: if code size is <250Mb, use S3
Links ‹#› My own XW article Benchmarks performed by Aaron Stuyvenberg AWS Blog post about Lambda container limitations AWS Blog post on how to optimize Lambda containers