Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
aws avatar

Aws Lambda Managed Instances

  • 2k installs
  • 2.2k repo stars
  • Updated August 4, 2026
  • aws/agent-toolkit-for-aws

Evaluates, configures, and migrates workloads to AWS Lambda Managed Instances (LMI).

About

Evaluates, configures, and migrates workloads to AWS Lambda Managed Instances (LMI). Runs Lambda functions on EC2 instances in the user's account while AWS manages provisioning, patching, scaling, routing, and load balancing. Triggers when queries mention Lambda Managed Instances, LMI, capacity providers, multi-concurrent execution environments, EC2-backed Lambda, persistent Lambda instances, PerExecutionEnvironmentMaxConcurrency, CapacityProviderConfig, cold start elimination via dedicated instances, migrating standard Lambda to managed instances, or cost comparison between standard Lambda and LMI with Savings Plans or Reserved Instances. Runs Lambda functions on EC2 instances in the user's account while AWS manages provisioning, patching, scaling, routing, and load balancing. Combines Lambda's developer experience with EC2's pricing and hardware options.

  • # AWS Lambda Managed Instances (LMI)
  • **Note:** Confirm regional availability, quotas, and instance type offerings against current AWS documentation before pr
  • ## Quick Decision: Is LMI Right for This Workload?
  • | Signal | LMI is a strong fit | Standard Lambda is better |
  • |--------|---------------------|---------------------------|

Aws Lambda Managed Instances by the numbers

  • 1,991 all-time installs (skills.sh)
  • +400 installs in the week ending Aug 5, 2026 (Skillselion tracking)
  • Ranked #392 of 2,153 Testing & QA skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
At a glance

aws-lambda-managed-instances capabilities & compatibility

Capabilities
# aws lambda managed instances (lmi) · **note:** confirm regional availability, quotas, · ## quick decision: is lmi right for this workloa · | signal | lmi is a strong fit | standard lambda
Use cases
documentation
From the docs

What aws-lambda-managed-instances says it does

Evaluates, configures, and migrates workloads to AWS Lambda Managed Instances (LMI). Runs Lambda functions on EC2 instances in the user's account while AWS manages provisioning, patching, scaling, rou
SKILL.md
npx skills add https://github.com/aws/agent-toolkit-for-aws --skill aws-lambda-managed-instances

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs2k
repo stars2.2k
Last updatedAugust 4, 2026
Repositoryaws/agent-toolkit-for-aws

How do I apply aws-lambda-managed-instances using the workflow in its SKILL.md?

Evaluates, configures, and migrates workloads to AWS Lambda Managed Instances (LMI). Runs Lambda functions on EC2 instances in the user's account while AWS manages provisioning, patching,...

Who is it for?

Developers following the aws-lambda-managed-instances skill for the tasks it documents.

Skip if: Tasks outside the aws-lambda-managed-instances scope described in SKILL.md.

When should I use this skill?

User mentions aws-lambda-managed-instances or related triggers from the skill description.

What you get

Working aws-lambda-managed-instances setup aligned with the documented patterns and constraints.

Files

SKILL.mdMarkdownGitHub ↗

AWS Lambda Managed Instances (LMI)

Runs Lambda functions on EC2 instances in the user's account while AWS manages provisioning, patching, scaling, routing, and load balancing. Combines Lambda's developer experience with EC2's pricing and hardware options.

Works best with the AWS MCP server for sandboxed CLI execution and audit logging. All guidance also works with standard AWS CLI or SAM CLI.

Note: Confirm regional availability, quotas, and instance type offerings against current AWS documentation before production deployment.

Quick Decision: Is LMI Right for This Workload?

SignalLMI is a strong fitStandard Lambda is better
TrafficSteady, predictable, 50M+ req/moBursty, unpredictable, long periods of no traffic
CostDuration-heavy spend at scaleLow or sporadic invocations
Cold startsUnacceptable (LMI eliminates for provisioned capacity)Tolerable
ComputeLatest CPUs, specific families, high network bandwidth, GPU requirementsStandard Lambda memory/CPU sufficient
IsolationDedicated EC2 instances in your account, full VPC controlShared Firecracker micro-VMs acceptable
Scale-to-zeroDoes not scale to zero but can create custom schedules with AWS provided solutionsRequired (pay nothing when idle)
Code readinessThread-safe (Node.js/Java/.NET) or any Python codeNon-thread-safe code, expensive to change

Routing

Read ONLY the single reference file that matches the user's task. Do not preload multiple references.

User needAction
Cost comparison, pricing analysis, Savings Plans, Reserved InstancesRead cost-comparison.md
Instance types, memory sizing, vCPU ratios, scaling tuning, capacity provider configRead configuration-guide.md
Thread safety, concurrency model, code review checklist, multi-concurrency readinessRead thread-safety.md
Before/after code examples, runtime-specific migration, connection poolingRead migration-patterns.md
IAM roles, VPC setup, CLI commands, SAM template, CDK exampleRead infrastructure-setup.md
Errors, throttling, debugging, stuck deploymentsRead troubleshooting.md

Troubleshooting quick facts (always mention when diagnosing issues):

  • Capacity provider stuck in CREATING → most common cause is private subnets missing a NAT gateway route (instances need outbound internet for image pull and Lambda service communication)
  • Function not scaling → check that a version is published (PublishToLatestPublished: true)
  • Memory errors → LMI minimum is 2048 MB

Workflow

Step 1: Assess the Workload

Gather these signals before recommending:

1. Traffic pattern: Steady vs bursty? Requests per second? 2. Current costs: Monthly Lambda spend? Existing Savings Plans? 3. Runtime: Node.js, Java, .NET, or Python? 4. Memory/CPU: How much memory? CPU-bound or I/O-bound? 5. Execution duration: Average and P99? 6. Concurrency readiness: Thread safety? Shared /tmp paths? Per-invocation DB connections? 7. VPC: Already in a VPC? Private resource access needed?

When recommending LMI, ALWAYS mention: minimum 3 execution environments for AZ resiliency (cannot go below 3 in production).

Step 2: Build the Cost Comparison

REQUIRED: Present a cost comparison before recommending LMI.

Rule of thumb: LMI becomes cost-competitive at 50-100M+ req/month with steady traffic. Use the LMI Pricing Calculator for accurate comparisons.

Step 3: Configure the Deployment

  • Instance families (400+ types, .large and up): C-series (compute), M-series (general), R-series (memory). ARM (Graviton) for best price-performance.
  • When using Graviton instances, MUST set `Architectures: [arm64]` in the function configuration to match.
  • Memory-to-vCPU ratios: 2:1 (compute), 4:1 (general, default), 8:1 (memory). Min 2 GB, max 32 GB.
  • Multi-concurrency per-vCPU maximums: Node.js 64, Java 32, .NET 32, Python 16. These are system caps — the actual setting is PerExecutionEnvironmentMaxConcurrency (per execution environment, not per vCPU).
  • For I/O-bound workloads: use the runtime default or higher PerExecutionEnvironmentMaxConcurrency (e.g., 10 for Node.js) since each request uses minimal CPU while waiting on network.
  • For CPU-bound workloads: set PerExecutionEnvironmentMaxConcurrency to 1-2 per vCPU since each request saturates CPU.
  • Scaling: MinExecutionEnvironments (default 3), MaxVCpuCount (optional, default 400 — set explicitly as best practice), TargetResourceUtilization.

Step 4: Migrate the Code

Review code for concurrency safety. LMI runs multiple invocations concurrently per execution environment:

  • Python: Process-based isolation — globals are NOT shared. No thread-safety changes needed. Focus on /tmp conflicts and memory sizing.
  • Node.js: Worker threads — globals shared within a worker. Requires async safety.
  • Java/.NET: OS threads/Tasks — handler shared across threads. Requires full thread safety.

Step 5: Set Up Infrastructure

1. Create two IAM roles: execution role (for the function) and operator role (for capacity provider EC2 management) 2. Configure VPC with subnets across 3+ AZs 3. Create capacity provider with VPC config and scaling limits 4. Create or update function with capacity provider attachment 5. Publish a version (triggers instance provisioning)

Step 6: Validate and Cut Over

1. Deploy to a non-production environment first 2. Monitor CloudWatch: CPU utilization, memory, concurrency, throttle rate 3. Gradual traffic shift with weighted aliases (10% → 50% → 100%) 4. Compare costs after 1-2 weeks of production data 5. Decommission standard Lambda once stable

Best Practices

Pricing (always mention when discussing costs)

  • Three components: EC2 instance hours + 15% management fee + $0.20/1M requests
  • Savings Plans: Compute Savings Plans apply to the EC2 portion (up to 60-72% discount)
  • The 15% fee is charged on top of EC2 cost for AWS managing provisioning, patching, scaling, lifecycle

Scaling (always mention when discussing scaling or traffic)

  • LMI absorbs a 50% traffic spike immediately and doubles capacity within 5 minutes — if traffic more than doubles faster, requests throttle
  • Standard Lambda bursts to 3000 instantly — LMI cannot match this
  • Pre-warm with MinExecutionEnvironments before known spikes
  • MaxVCpuCount (default 400) — set explicitly as a cost ceiling
  • Shape: Reduce MinExecutionEnvironments to lower capacity during off-hours (minimum 3 for AZ resiliency)

Instance Sizing

  • 1 vCPU + 1 GB reserved per instance for OS overhead (not available to your function)
  • Usable capacity = total - overhead

Configuration

  • Start with 4:1 ratio and runtime default concurrency
  • Use ARM (Graviton) unless x86 dependencies exist
  • Let Lambda choose instance types unless specific hardware needed
  • Set MaxVCpuCount to control cost ceiling
  • Never set MinExecutionEnvironments below 3 (breaks AZ resiliency)

Migration

  • Start with I/O-heavy functions (benefit most from multi-concurrency)
  • Review code for concurrency safety before attaching to capacity provider
  • Use weighted aliases for gradual traffic shift
  • Include request IDs in all log statements
  • Initialize DB pools and SDK clients outside the handler

Operations

  • Set CloudWatch alarms on throttle rate > 1% and CPU > 80%
  • Plan for 14-day instance rotation (automatic)
  • Never manually terminate LMI EC2 instances (delete the capacity provider instead)
  • Always publish a version — unpublished functions cannot run on LMI

Limits Quick Reference

ResourceLimit
Memory2 GB min, 32 GB max
Execution environments3 minimum (MinExecutionEnvironments, AZ resiliency)
Instance lifespan14 days (auto-replaced)
Concurrency/vCPU64 (Node.js), 32 (Java/.NET), 16 (Python)
RuntimesNode.js 22+, Java 21+, .NET 8+, Python 3.13+, Rust (provided.al2023)
Instance familiesC, M, R (.large and up)
ScalingBurst headroom equals unused capacity from TargetResourceUtilization; new instances launch within minutes

Security Considerations

  • Operator role scoping: Add aws:SourceAccount and aws:SourceArn conditions to trust policies to prevent confused deputy attacks.
  • VPC egress: Scope security group egress to VPC endpoint security groups or AWS prefix lists rather than 0.0.0.0/0.
  • Credentials: Use AWS Secrets Manager or Parameter Store for database credentials — never environment variables for secrets.
  • Encryption: Enable SQS SSE, CloudWatch Logs encryption (KMS), and S3 default encryption for any data at rest.
  • Logging: Set CloudWatch Log group retention policies. Avoid logging PII or credentials. Enable CloudTrail data events for Lambda.
  • Instance rotation: The 14-day automatic rotation ensures security patches are applied without manual intervention.
  • References: Lambda Security Best Practices, IAM Best Practices

Files

FileContent
cost-comparison.mdPricing analysis, break-even calculations, Savings Plans/RI impact
configuration-guide.mdInstance selection, memory ratios, scaling tuning, capacity provider config
thread-safety.mdConcurrency model per runtime, code review checklist, Powertools compatibility
migration-patterns.mdBefore/after code by runtime, connection pooling, gradual cutover
infrastructure-setup.mdIAM roles, VPC setup, SAM templates, CLI commands
troubleshooting.mdCommon errors, throttling, debugging, stuck deployments

Related skills

FAQ

What does aws-lambda-managed-instances do?

Evaluates, configures, and migrates workloads to AWS Lambda Managed Instances (LMI). Runs Lambda functions on EC2 instances in the user's account while AWS manages provisioning, patching,...

When should I use aws-lambda-managed-instances?

Invoke when Evaluates, configures, and migrates workloads to AWS Lambda Managed Instances (LMI). Runs Lambda functions on EC2 instances in the user's ac.

Is aws-lambda-managed-instances safe to install?

Review the Security Audits panel on this page before installing in production.

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.