EKS to AgentCore Migration Guide
Overview
Migrate AI agents from Amazon EKS (containerized Kubernetes workloads) to Amazon Bedrock AgentCore (serverless, purpose-built agent runtime). This skill provides the domain knowledge to guide the migration end-to-end, from assessment through cutover.
AgentCore eliminates Kubernetes infrastructure management by providing a fully managed runtime with built-in session isolation (microVMs), memory, identity, observability, and consumption-based pricing.
Process
Phase 1: Assess
- Identify agent workloads on EKS — use
scan_eks_cluster MCP tool or kubectl get deployments
- For each agent, evaluate:
- Python version (must be 3.10+)
- Framework (Strands, LangChain, LangGraph, CrewAI, Google ADK, OpenAI Agents, or custom)
- External dependencies (databases, APIs, caches)
- Kubernetes-specific dependencies (PVCs, Secrets, ConfigMaps, HPA, service mesh)
- Entrypoint file (AgentCore expects
main.py)
- Use
assess_agent or assess_cluster MCP tools for automated assessment
- Prioritize: start with low-complexity agents (supported framework, no PVCs, no custom networking)
Phase 2: Scaffold
- Install AgentCore CLI:
npm install -g @aws/agentcore
- Create project:
agentcore create --name <AgentName> --defaults
- Use
generate_agentcore_project MCP tool for customized scaffold commands
- Choose build type:
- CodeZip (default, recommended) — no Dockerfile needed
- Container — only if agent has heavy system-level dependencies (CUDA, custom native libs)
Phase 3: Migrate Code
- Copy agent source to
app/<AgentName>/
- Create
main.py with AgentCore Runtime wrapper — use generate_main_py MCP tool
- The wrapper pattern for Strands agents:
from strands import Agent
from bedrock_agentcore.runtime import BedrockAgentCoreApp
agent = Agent(model="...", system_prompt="...", tools=[...])
app = BedrockAgentCoreApp()
@app.entrypoint
def invoke(payload):
response = agent(payload.get("prompt", ""))
return response.message["content"][0]["text"]
if __name__ == "__main__":
app.run()
- Update
pyproject.toml — remove K8s-specific deps (gunicorn, uvicorn, kubernetes client)
- Remove web framework serving code (Flask/FastAPI) — AgentCore handles HTTP natively
Phase 4: Migrate Configuration
- Secrets →
agentcore add credential --name <svc> --api-key <key> or --type oauth
- ConfigMaps/env vars →
agentcore.json configuration
- Networking:
- Internet-only APIs →
"networkMode": "PUBLIC" (default)
- Private resources (RDS, ElastiCache) →
"networkMode": "VPC"
- Memory/state (Redis, DynamoDB) →
agentcore add memory --strategies SEMANTIC,SUMMARIZATION
- IRSA → AgentCore Identity (CDK creates execution roles automatically)
Phase 5: Test & Deploy
- Test locally:
agentcore dev then agentcore dev "test prompt"
- Preview:
agentcore deploy --plan
- Deploy:
agentcore deploy
- Verify:
agentcore status and agentcore invoke --runtime <AgentName> "test"
- Set up CI/CD — use
generate_cicd_pipeline MCP tool
Phase 6: Cutover
- Run both EKS and AgentCore agents in parallel
- Route traffic gradually using weighted routing
- Monitor via
agentcore logs and agentcore traces list
- After validation, scale down EKS:
kubectl scale deployment <name> --replicas=0
- Clean up K8s resources (Deployment, Service, Ingress, HPA, Secrets, ConfigMaps)
Key Decisions
| Decision |
Recommendation |
| Build type |
CodeZip unless you need CUDA/GPU or custom native libraries |
| Network mode |
PUBLIC for internet APIs, VPC for private resources (RDS, ElastiCache) |
| Framework |
Strands has the smoothest migration path; LangChain/LangGraph supported; custom needs service contract |
| Memory |
Use AgentCore Memory to replace Redis/DynamoDB session state |
| CI/CD |
agentcore deploy replaces Docker build + ECR push + kubectl apply |
Common Pitfalls
- AgentCore Memory is NOT available during local dev (
agentcore dev). Deploy first to test memory.
- Entrypoint must be
main.py (or configured in agentcore.json)
- Remove Flask/FastAPI/uvicorn — AgentCore Runtime handles HTTP serving
- Extended execution supports up to 8 hours. Decompose longer workloads.
- First deployment takes a few minutes while CDK bootstraps your account
- EKS tokens expire every ~15 minutes. Refresh with
aws eks update-kubeconfig
MCP Tools Reference
This skill works with the eks-to-agentcore MCP server. Available tools:
| Tool |
Purpose |
scan_eks_cluster |
Discover AI agent deployments on EKS (specify namespace for least privilege) |
assess_agent |
Assess a single agent for migration compatibility |
assess_cluster |
Full cluster scan + assessment report |
generate_agentcore_project |
Generate agentcore CLI scaffold commands |
generate_cicd_pipeline |
Generate CodeBuild or GitHub Actions pipeline config |
generate_main_py |
Generate ready-to-use main.py with AgentCore Runtime wrapper |
get_eks_agentcore_feature_map |
EKS-to-AgentCore feature mapping and cleanup checklist |
Guidelines
- Always specify a namespace when scanning (
scan_eks_cluster(namespace="agents")) to follow least-privilege principles
- Env var values are never captured — only names are used for heuristic analysis
- Start with the simplest agent (low complexity) as a pilot migration
- Use CodeZip build type unless you have a specific reason for Container
- Keep the EKS agent running in standby for 1-2 weeks after cutover as a rollback option
- Use
agentcore deploy --plan before every deployment to preview changes
1---2name: eks-to-agentcore3description: Guide for migrating AI agents from Amazon EKS to Amazon Bedrock AgentCore. Use when assessing EKS agent workloads for migration, scaffolding AgentCore projects, generating entrypoint code, configuring CI/CD pipelines, or understanding the EKS-to-AgentCore feature mapping. Works with the eks-to-agentcore MCP server for live cluster scanning and automated assessment.4license: MIT-0 — see LICENSE in the repository root5---67# EKS to AgentCore Migration Guide89## Overview1011Migrate AI agents from Amazon EKS (containerized Kubernetes workloads) to Amazon Bedrock AgentCore (serverless, purpose-built agent runtime). This skill provides the domain knowledge to guide the migration end-to-end, from assessment through cutover.1213AgentCore eliminates Kubernetes infrastructure management by providing a fully managed runtime with built-in session isolation (microVMs), memory, identity, observability, and consumption-based pricing.1415---1617## Process1819### Phase 1: Assess20211. Identify agent workloads on EKS — use `scan_eks_cluster` MCP tool or `kubectl get deployments`222. For each agent, evaluate:23 - Python version (must be 3.10+)24 - Framework (Strands, LangChain, LangGraph, CrewAI, Google ADK, OpenAI Agents, or custom)25 - External dependencies (databases, APIs, caches)26 - Kubernetes-specific dependencies (PVCs, Secrets, ConfigMaps, HPA, service mesh)27 - Entrypoint file (AgentCore expects `main.py`)283. Use `assess_agent` or `assess_cluster` MCP tools for automated assessment294. Prioritize: start with low-complexity agents (supported framework, no PVCs, no custom networking)3031### Phase 2: Scaffold32331. Install AgentCore CLI: `npm install -g @aws/agentcore`342. Create project: `agentcore create --name <AgentName> --defaults`353. Use `generate_agentcore_project` MCP tool for customized scaffold commands364. Choose build type:37 - **CodeZip** (default, recommended) — no Dockerfile needed38 - **Container** — only if agent has heavy system-level dependencies (CUDA, custom native libs)3940### Phase 3: Migrate Code41421. Copy agent source to `app/<AgentName>/`432. Create `main.py` with AgentCore Runtime wrapper — use `generate_main_py` MCP tool443. The wrapper pattern for Strands agents:45 ```python46 from strands import Agent47 from bedrock_agentcore.runtime import BedrockAgentCoreApp4849 agent = Agent(model="...", system_prompt="...", tools=[...])50 app = BedrockAgentCoreApp()5152 @app.entrypoint53 def invoke(payload):54 response = agent(payload.get("prompt", ""))55 return response.message["content"][0]["text"]5657 if __name__ == "__main__":58 app.run()59 ```604. Update `pyproject.toml` — remove K8s-specific deps (gunicorn, uvicorn, kubernetes client)615. Remove web framework serving code (Flask/FastAPI) — AgentCore handles HTTP natively6263### Phase 4: Migrate Configuration64651. **Secrets** → `agentcore add credential --name <svc> --api-key <key>` or `--type oauth`662. **ConfigMaps/env vars** → `agentcore.json` configuration673. **Networking**:68 - Internet-only APIs → `"networkMode": "PUBLIC"` (default)69 - Private resources (RDS, ElastiCache) → `"networkMode": "VPC"`704. **Memory/state** (Redis, DynamoDB) → `agentcore add memory --strategies SEMANTIC,SUMMARIZATION`715. **IRSA** → AgentCore Identity (CDK creates execution roles automatically)7273### Phase 5: Test & Deploy74751. Test locally: `agentcore dev` then `agentcore dev "test prompt"`762. Preview: `agentcore deploy --plan`773. Deploy: `agentcore deploy`784. Verify: `agentcore status` and `agentcore invoke --runtime <AgentName> "test"`795. Set up CI/CD — use `generate_cicd_pipeline` MCP tool8081### Phase 6: Cutover82831. Run both EKS and AgentCore agents in parallel842. Route traffic gradually using weighted routing853. Monitor via `agentcore logs` and `agentcore traces list`864. After validation, scale down EKS: `kubectl scale deployment <name> --replicas=0`875. Clean up K8s resources (Deployment, Service, Ingress, HPA, Secrets, ConfigMaps)8889---9091## Key Decisions9293| Decision | Recommendation |94|----------|---------------|95| Build type | CodeZip unless you need CUDA/GPU or custom native libraries |96| Network mode | PUBLIC for internet APIs, VPC for private resources (RDS, ElastiCache) |97| Framework | Strands has the smoothest migration path; LangChain/LangGraph supported; custom needs service contract |98| Memory | Use AgentCore Memory to replace Redis/DynamoDB session state |99| CI/CD | `agentcore deploy` replaces Docker build + ECR push + kubectl apply |100101---102103## Common Pitfalls104105- AgentCore Memory is NOT available during local dev (`agentcore dev`). Deploy first to test memory.106- Entrypoint must be `main.py` (or configured in `agentcore.json`)107- Remove Flask/FastAPI/uvicorn — AgentCore Runtime handles HTTP serving108- Extended execution supports up to 8 hours. Decompose longer workloads.109- First deployment takes a few minutes while CDK bootstraps your account110- EKS tokens expire every ~15 minutes. Refresh with `aws eks update-kubeconfig`111112---113114## MCP Tools Reference115116This skill works with the `eks-to-agentcore` MCP server. Available tools:117118| Tool | Purpose |119|------|---------|120| `scan_eks_cluster` | Discover AI agent deployments on EKS (specify namespace for least privilege) |121| `assess_agent` | Assess a single agent for migration compatibility |122| `assess_cluster` | Full cluster scan + assessment report |123| `generate_agentcore_project` | Generate agentcore CLI scaffold commands |124| `generate_cicd_pipeline` | Generate CodeBuild or GitHub Actions pipeline config |125| `generate_main_py` | Generate ready-to-use main.py with AgentCore Runtime wrapper |126| `get_eks_agentcore_feature_map` | EKS-to-AgentCore feature mapping and cleanup checklist |127128---129130## Guidelines131132- Always specify a namespace when scanning (`scan_eks_cluster(namespace="agents")`) to follow least-privilege principles133- Env var values are never captured — only names are used for heuristic analysis134- Start with the simplest agent (low complexity) as a pilot migration135- Use CodeZip build type unless you have a specific reason for Container136- Keep the EKS agent running in standby for 1-2 weeks after cutover as a rollback option137- Use `agentcore deploy --plan` before every deployment to preview changes