Resolved

Unnecessary cloud infrastructure costs for locally executed workloads

Cloud Costs
DevOps
Infrastructure as Code
Kubernetes
Local Development
Azure
Optimization

Project incurred significant Azure cloud costs ($185/month) for Kubernetes and AI services that were entirely redundant, as all execution occurred locally via stdio transport.

Issue

The project was incurring $185/month in Azure cloud costs for infrastructure—including Kubernetes clusters, AI services, and monitoring—that was entirely unnecessary. All execution occurred locally using a stdio-based transport protocol, rendering the cloud deployment redundant. Unused resources included:

  • Kubernetes clusters with high-end virtual machines.
  • Azure OpenAI embedding services.
  • Networking components and private endpoints.
  • Comprehensive monitoring tools.

Culprit

The architectural mismatch stemmed from:

  1. Protocol Limitations: The MCP protocol primarily relied on local stdio transport for process communication, not cloud-native HTTP/SSE endpoints.
  2. Development Workflow Assumptions: The local server execution (poetry run python -m src.server) was the primary mode, making cloud deployment obsolete.
  3. Over-Provisioning: Cloud resources were provisioned without validating actual usage needs.
  4. Cost Accumulation: A total of 38 cloud resources (application and foundation layers) were deployed but unused.

Solution

Infrastructure Teardown

  1. Resource Deletion: Executed a complete removal of all Azure resources using infrastructure-as-code tools, eliminating:

    • Kubernetes clusters with associated identities and role assignments.
    • Azure AI services and embedding models.
    • Virtual networks, private endpoints, and networking components.
    • Monitoring stacks (log analytics, application insights).
  2. Local Configuration Cleanup: Removed redundant cloud-specific configurations, including:

    • Kubernetes context entries.
    • Environment variables for cloud API keys.
    • Cloud deployment scripts and port-forwarding processes.

Cost Optimization

Resource TypeBefore CostAfter CostSavings
Kubernetes Cluster$120/month$0$120
AI Services$45/month$0$45
Monitoring Stack$20/month$0$20
Total$185$0$185

Verification Process

  1. Resource Validation: Confirmed all cloud resources were successfully removed.
  2. Cost Monitoring: Verified zero daily cloud spend post-teardown via billing dashboards.

Preserved Assets

  • Infrastructure-as-code templates for potential future redeployment.
  • Kubernetes manifests as reference materials.
  • Local data storage (e.g., vector databases) and workflows.

Local Stack Components

The local setup retained full functionality:

  • Vector databases for embeddings.
  • GPU-accelerated local inference.
  • Persistent local storage for all data.

The solution eliminated all cloud costs while maintaining performance, with the flexibility to redeploy cloud resources if requirements change in the future.