[{"data":1,"prerenderedAt":127},["ShallowReactive",2],{"pattern-lambda-microvms-codex-agent-python-cloudformation":3,"pattern-group-lambda-microvms-codex-agent-python-cloudformation":95},{"id":4,"title":5,"architectureURL":6,"cleanup":7,"contributors":10,"deploy":12,"description":16,"extension":17,"framework":18,"gitHub":19,"highlight":6,"introBox":23,"language":30,"level":31,"meta":32,"patternArch":33,"patternGroup":61,"patternGroupLabel":6,"resources":62,"stem":87,"testing":88,"videoId":6,"__hash__":94},"patterns\u002Fpatterns\u002Flambda-microvms-codex-agent-python-cloudformation.json","Codex CLI Agent on AWS Lambda MicroVMs",null,{"text":8},[9],"\u003Ccode>MICROVM_ID=\"&lt;microvm-id&gt;\" AWS_REGION=\"$AWS_REGION\" .\u002Fcleanup.sh\u003C\u002Fcode>",[11],"content\u002Fcontributors\u002Fdmitry-gulin.json",{"text":13},[14,15],"export AWS_REGION=\"us-east-2\"",".\u002Fdeploy.sh","Deploy an AWS Lambda MicroVM with the OpenAI Codex CLI, powered by Amazon Bedrock and reachable through an interactive shell.","json","AWS CloudFormation",{"template":20},{"patternPath":21,"templateFile":22},"lambda-microvms-codex-agent\u002Fpython\u002Fcloudformation","template.yaml",{"headline":24,"text":25},"How it works",[26,27,28,29],"This pattern deploys an AWS Lambda MicroVM with the Codex CLI baked into the image. The MicroVM is launched with the `SHELL_INGRESS` network connector, so you connect over an interactive shell and run `codex` directly inside the isolated Firecracker VM.","Codex uses its built-in `amazon-bedrock` model provider, so inference runs on Amazon Bedrock with credentials supplied at runtime by the MicroVM execution role. There is no ChatGPT sign-in, no `OPENAI_API_KEY`, and no Amazon Bedrock API key stored in the image. Codex is also wired to the AWS MCP Server from the Agent Toolkit for AWS through the MCP Proxy for AWS, which signs each request with AWS Signature Version 4 (SigV4) using the same execution-role credentials, so it can make live AWS API calls, search AWS documentation, and retrieve AWS skills. Access is read-only, enforced by AWS Identity and Access Management (IAM).","The image is Region-agnostic: `src\u002Fapp.py` renders the model, MCP endpoint, and Region into the Codex configuration at runtime from the MicroVM environment, at startup and on every run and resume. The MicroVM suspends when idle, resumes on demand, and has a hard maximum lifetime, so treat it as disposable.","See the README in the GitHub repository for deployment steps, design notes, and troubleshooting.","Python","200",{},{"icon1":34,"icon2":39,"icon3":43,"icon4":48,"line1":52,"line2":56,"line3":58},{"x":35,"y":36,"service":37,"label":38},12,50,"icon-internet","Your terminal",{"x":40,"y":36,"service":41,"label":42},45,"lambda-microvms","AWS Lambda MicroVM",{"x":44,"y":45,"service":46,"label":47},85,30,"bedrock","Amazon Bedrock",{"x":44,"y":49,"service":50,"label":51},70,"icon-api","AWS MCP Server",{"from":53,"to":54,"label":55},"icon1","icon2","shell",{"from":54,"to":57},"icon3",{"from":54,"to":59,"label":60},"icon4","SigV4","lambda-microvms-codex-agent",{"bullets":63},[64,67,70,73,76,79,81,84],{"text":65,"link":66},"AWS Lambda MicroVMs Documentation","https:\u002F\u002Fdocs.aws.amazon.com\u002Flambda\u002Flatest\u002Fdg\u002Flambda-microvms-guide.html",{"text":68,"link":69},"Configure Codex with Amazon Bedrock","https:\u002F\u002Fhelp.openai.com\u002Fen\u002Farticles\u002F20001253-configure-codex-with-amazon-bedrock",{"text":71,"link":72},"Amazon Bedrock Responses API (OpenAI-compatible)","https:\u002F\u002Fdocs.aws.amazon.com\u002Fbedrock\u002Flatest\u002Fuserguide\u002Finference-responses-api.html",{"text":74,"link":75},"Codex CLI configuration reference","https:\u002F\u002Fdevelopers.openai.com\u002Fcodex\u002Fconfig-reference",{"text":77,"link":78},"Agent Toolkit for AWS","https:\u002F\u002Fgithub.com\u002Faws\u002Fagent-toolkit-for-aws",{"text":51,"link":80},"https:\u002F\u002Fdocs.aws.amazon.com\u002Fagent-toolkit\u002Flatest\u002Fuserguide\u002Fmcp-server.html",{"text":82,"link":83},"MCP Proxy for AWS","https:\u002F\u002Fgithub.com\u002Faws\u002Fmcp-proxy-for-aws",{"text":85,"link":86},"Firecracker - Secure and fast microVMs for serverless computing","https:\u002F\u002Faws.amazon.com\u002Fblogs\u002Fopensource\u002Ffirecracker-open-source-secure-fast-microvm-serverless\u002F","patterns\u002Flambda-microvms-codex-agent-python-cloudformation",{"text":89},[90,91,92,93],"Connect to the MicroVM over an interactive shell: \u003Ccode>.\u002Fconnect.sh &lt;microvm-id&gt; $AWS_REGION\u003C\u002Fcode>","Inside the shell, confirm Codex and run a completion: \u003Ccode>codex --version\u003C\u002Fcode> then \u003Ccode>codex exec \"Say hello in one word\"\u003C\u002Fcode>","Exercise the AWS MCP Server: \u003Ccode>codex exec \"search the AWS documentation for Lambda MicroVMs idle policy\"\u003C\u002Fcode>","See the GitHub repo for detailed testing instructions.","ncdp00B3yT_i15098jQ4ay0IaKUj_MbkzA5kWULnkPQ",[96],{"id":4,"title":5,"architectureURL":6,"cleanup":97,"contributors":99,"deploy":100,"description":16,"extension":17,"framework":18,"gitHub":102,"highlight":6,"introBox":104,"language":30,"level":31,"meta":106,"patternArch":107,"patternGroup":61,"patternGroupLabel":6,"resources":115,"stem":87,"testing":125,"videoId":6,"__hash__":94},{"text":98},[9],[11],{"text":101},[14,15],{"template":103},{"patternPath":21,"templateFile":22},{"headline":24,"text":105},[26,27,28,29],{},{"icon1":108,"icon2":109,"icon3":110,"icon4":111,"line1":112,"line2":113,"line3":114},{"x":35,"y":36,"service":37,"label":38},{"x":40,"y":36,"service":41,"label":42},{"x":44,"y":45,"service":46,"label":47},{"x":44,"y":49,"service":50,"label":51},{"from":53,"to":54,"label":55},{"from":54,"to":57},{"from":54,"to":59,"label":60},{"bullets":116},[117,118,119,120,121,122,123,124],{"text":65,"link":66},{"text":68,"link":69},{"text":71,"link":72},{"text":74,"link":75},{"text":77,"link":78},{"text":51,"link":80},{"text":82,"link":83},{"text":85,"link":86},{"text":126},[90,91,92,93],1794310737248]