AWS Lambda Adds GPU Inference on Managed Instances
Contents
AWS added GPU support to AWS Lambda. Event Functions running on Lambda Managed Instances can now execute workloads on EC2 G-series instances, including G4dn, G5, G6, G6f, Gr6, Gr6f, and G6e. Packaged as OCI container images, these functions link directly with AWS event sources without requiring teams to configure GPU drivers, align CUDA versions, or maintain Kubernetes device plugins.
EC2 G-Series on Lambda Managed Instances
Managed Instances transfer instance provisioning and host patching to AWS while running on EC2 capacity selected by the customer. Capacity providers define the target VPC, a vCPU limit, and permitted instance families. The runtime defaults to the newest available generation and falls back automatically if capacity is tight.
{
"InstanceRequirements": {
"AllowedInstanceTypes": ["g5.2xlarge", "g6.2xlarge", "g6e.2xlarge"]
},
"CapacityProviderScalingConfig": { "ScalingMode": "Auto", "MaxVCpuCount": 96 }
}Function configurations include an AcceleratorConfig block alongside memory and execution timeouts, giving direct control over allocated GPU VRAM per execution environment.
Memory Sharing and Turnkey Base Images
Up to 48 concurrent invocations in a single execution environment can query a shared in-memory model copy. Lambda scales environments based on combined GPU utilization, CPU load, and active concurrency metrics.
AWS supplies five official GPU base images: CUDA only, CuPy, PyTorch, vLLM, and SGLang. Using the vLLM or SGLang engines eliminates boilerplate handler code. Updating the model requires only changing the configuration to point to an S3 path or Hugging Face repository:
aws lambda update-function-configuration \n --function-name my-gpu-function \n --environment 'Variables={MODEL_ID=s3://amzn-s3-demo-bucket/models/Qwen2.5-1.5B-Instruct/,VLLM_LOAD_FORMAT=runai_streamer}'Pricing, Startup Latency, and Limitations
Billing follows the Managed Instances model: standard EC2 On-Demand rates plus a 9.75 percent management fee and $0.20 per million requests. Compute Savings Plans and Reserved Instances apply directly to the underlying EC2 tier.
Benchmarks show PyTorch running up to 66 times faster on an NVIDIA L4 than on an instance CPU, but several operational constraints apply:
- Provisioning fresh EC2 capacity takes tens of seconds, so abrupt traffic spikes remain better suited for pre-warmed pools or standard Lambda architectures.
- New AWS accounts default to zero GPU vCPUs, requiring quota increases before capacity providers can launch instances.
- GPU support is currently restricted to Event Functions and does not extend to streaming HTTP Web Functions.