@@ -458,13 +458,14 @@ REGION=$(aws configure get region)
458458# Find your Agent Space ID
459459aws devops-agent list-agent-spaces --region $REGION --no-cli-pager
460460
461- # 1. Disassociate MCP server from agent space (must be done BEFORE deregister or agent space delete)
462- # First, get the association ID:
463- # aws devops-agent list-associations --agent-space-id <id> --region $REGION --no-cli-pager
464- # Find the MCP server entry and note the associationId and serviceId
461+ # 1. List associations to find the MCP server' s associationId and serviceId
462+ aws devops-agent list-associations --agent-space-id < id> --region $REGION --no-cli-pager
463+ # Look for the entry with "mcpserver" in configuration — note its associationId and serviceId
464+
465+ # 2. Disassociate MCP server from agent space (must be done BEFORE deregister or agent space delete)
465466aws devops-agent disassociate-service --agent-space-id < id> --association-id < association-id> --region $REGION --no-cli-pager
466467
467- # 2 . Deregister MCP server (account-level, can only be done after disassociation)
468+ # 3 . Deregister MCP server (account-level, can only be done after disassociation)
468469aws devops-agent deregister-service --service-id < service-id> --region $REGION --no-cli-pager
469470
470471# 3. Delete the Agent Space
@@ -495,12 +496,14 @@ $Region = aws configure get region
495496# Find your Agent Space ID
496497aws devops-agent list-agent-spaces --region $Region --no-cli-pager
497498
498- # 1. Disassociate MCP server from agent space
499- # First, get the association ID:
500- # aws devops-agent list-associations --agent-space-id "<id>" --region $Region --no-cli-pager
499+ # 1. List associations to find the MCP server's associationId and serviceId
500+ aws devops-agent list-associations --agent-space-id " <id>" --region $Region --no-cli-pager
501+ # Look for the entry with "mcpserver" in configuration — note its associationId and serviceId
502+
503+ # 2. Disassociate MCP server from agent space (must be done BEFORE deregister or agent space delete)
501504aws devops-agent disassociate-service --agent-space-id " <id>" --association-id " <association-id>" --region $Region --no-cli-pager
502505
503- # 2 . Deregister MCP server
506+ # 3 . Deregister MCP server
504507aws devops-agent deregister-service --service-id " <service-id>" --region $Region --no-cli-pager
505508
506509# 3. Delete the Agent Space
@@ -533,7 +536,7 @@ aws ec2 delete-key-pair --key-name vpn-demo-key --region $Region
533536# ## Step 3: Verify cleanup
534537
535538` ` ` bash
536- bash scripts/verify-cleanup.sh < region>
539+ bash scripts/verify-cleanup.sh $( aws configure get region)
537540# Windows: .\scripts\verify-cleanup.ps1 -Region <region>
538541` ` `
539542
0 commit comments