Claude Code Agent on AWS Lambda MicroVMs

AWS Lambda MicroVMs

Deploy an AWS Lambda MicroVM with the Claude Code CLI, powered by Amazon Bedrock and reachable through an interactive shell.

This pattern deploys a Lambda MicroVM with the Claude Code CLI installed into the image. The MicroVM is launched with the SHELL_INGRESS network connector, so you connect via an interactive shell (AWS console or a WebSocket client) and run `claude` directly inside the MicroVM.
Claude Code is preconfigured to use Amazon Bedrock with Claude Sonnet 4.6. No API key is stored in the image — the Lambda MicroVM execution role supplies AWS credentials at runtime through the standard AWS SDK credential chain.
The image also bakes in the AWS API MCP server (awslabs.aws-api-mcp-server), letting Claude run live AWS API calls from inside the VM. It uses the same execution-role credentials via the boto3 default chain — no keys — and runs read-only by default (the managed ReadOnlyAccess policy plus READ_OPERATIONS_ONLY). What Claude can do in AWS is controlled entirely by the role's IAM policy.
The MicroVM image is built from a Dockerfile that Lambda executes server-side. During the build the Claude CLI, uv, and the AWS API MCP server are installed, and the application signals readiness via the /ready lifecycle hook, after which Lambda takes a snapshot for rapid resume. The VM auto-suspends when idle and resumes on demand.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/lambda-microvms-claude-code-agent

Deploy

bash deploy.sh


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

bash cleanup.sh

Created by:

Alexander Vladimirov

Alexander Vladimirov

Senior Serverless Solutions Architect at AWS, specializing in Agentic AI Workloads.

Follow on LinkedIn