Skip to content
Development
Skill

/aws-lambda-managed-instances

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

From plugin
agent-toolkit-for-aws
2.3k146 skills9 commands3 MCP
Install
$ npx -y skills add aws/agent-toolkit-for-aws --skill aws-lambda-managed-instances --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/aws-lambda-managed-instances

Context preview

The summary Claude sees to decide when to auto-load this skill.

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

SKILL.md

aws-lambda-managed-instances.SKILL.md
name: aws-lambda-managed-instances
description: "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."
version: 1

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](https://docs.aws.amazon.com/aws-mcp/) 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?

| Signal | LMI is a strong fit | Standard Lambda is better | |--------|---------------------|---------------------------| | Traffic | Steady, predictable, 50M+ req/mo | Bursty, unpredictable, long periods of no traffic | | Cost | Duration-heavy spend at scale | Low or sporadic invocations | | Cold starts | Unacceptable (LMI eliminates for provisioned capacity) | Tolerable | | Compute | Latest CPUs, specific families, high network bandwidth, GPU requirements | Standard Lambda memory/CPU sufficient | | Isolation | Dedicated EC2 instances in your account, full VPC control | Shared Firecracker micro-VMs acceptable | | Scale-to-zero | Does not scale to zero but can create custom schedules with AWS provided solutions | Required (pay nothing when idle) | | Code readiness | Thread-safe (Node.js/Java/.NET) or any Python code | Non-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 need | Action | |-----------|--------| | Cost comparison, pricing analysis, Savings Plans, Reserved Instances | Read [cost-comparison.md](references/cost-comparison.md) | | Instance types, memory sizing, vCPU ratios, scaling tuning, capacity provider config | Read [configuration-guide.md](references/configuration-guide.md) | | Thread safety, concurrency model, code review checklist, multi-concurrency readiness | Read [thread-safety.md](references/thread-safety.md) | | Before/after code examples, runtime-specific migration, connection pooling | Read [migration-patterns.md](references/migration-patterns.md) | | IAM roles, VPC setup, CLI commands, SAM template, CDK example | Read [infrastructure-setup.md](references/infrastructure-setup.md) | | Errors, throttling, debugging, stuck deployments | Read [troubleshooting.md](references/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](https://aws-samples.github.io/sample-aws-lambda-managed-instances/) 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
Read more
Ships withagent-toolkit-for-aws

Help AI coding agents build, deploy, and manage applications on AWS. The Agent Toolkit for AWS gives AI coding agents the tools, knowledge, and guardrails they need to work with AWS services.

Get the whole plugin

Other skills on agent-toolkit-for-aws.