Skip to main content

Azure Infrastructure Deployment

This section guides you through deploying the Azure infrastructure foundation required for AI/Run CodeMie using Terraform automation.

Existing Infrastructure

If you already have a provisioned AKS cluster with all required Azure services (networking, storage, databases, etc.), you can skip this section and proceed directly to Components Deployment.

Overview

The Terraform deployment is organized into three distinct phases, each with its own set of resources and purpose:

  1. Terraform State Backend - Infrastructure for storing Terraform state files securely
  2. Core Platform Infrastructure - Main Azure resources for running AI/Run CodeMie
  3. AI Model Deployments - Optional Azure OpenAI services for AI capabilities

This modular approach allows you to deploy only what you need and maintain clear separation between infrastructure layers.

Phase 1: Terraform State Backend

The state backend is deployed first to provide secure, centralized storage for Terraform state files.

ResourcePurpose
Resource GroupDedicated resource group for Terraform state management resources
Storage AccountAzure Storage Account for storing Terraform state files with versioning
Storage ContainersBlob containers for state files (tfstate) and deployment scripts (scripts)
State Backend Purpose

The Terraform state backend enables:

  • Team Collaboration: Multiple engineers can work on infrastructure simultaneously
  • State Locking: Prevents concurrent modifications that could corrupt state
  • Versioning: Maintains history of infrastructure changes
  • Security: State files contain sensitive data and require secure storage

Phase 2: Core Platform Infrastructure

The core platform infrastructure provisions all Azure resources needed to run AI/Run CodeMie. This is the main deployment phase and following Azure resources will be deployed:

Compute & Orchestration

ResourcePurpose
AKS ClusterPrivate Kubernetes cluster for running AI/Run CodeMie workloads
Default Node PoolPrimary node pool with system workloads
Additional Node PoolSecondary node pool for application workloads with custom labels/taints
Virtual Machine (Jumpbox)Management VM for secure cluster access and administrative tasks

Networking

ResourcePurpose
Hub Virtual NetworkCentral network hub for shared services (Bastion, private endpoints)
AKS Virtual NetworkIsolated network for AKS cluster with multiple dedicated subnets
VNet PeeringSecure connectivity between Hub and AKS virtual networks
NAT GatewayProvides consistent outbound public IP for internet connectivity
Public IP AddressStatic public IP associated with NAT Gateway
DNS ZonesName resolution for CodeMie components
Azure BastionSecure RDP/SSH access to VMs without exposing public IP addresses
Network Security GroupsFirewall rules controlling traffic flow between subnets

Data & Storage

ResourcePurpose
PostgreSQL Flexible ServerManaged database service for CodeMie application data with private connectivity
Storage AccountPersistent storage for CodeMie application data and artifacts
Container Registry (ACR)Private Docker image repository for CodeMie container images
Optional: Azure Container Registry

ACR deployment is optional. If you plan to use an external container registry (e.g., Google Container Registry, Docker Hub, or a corporate registry), ACR can be omitted from the deployment.

Security & Identity

ResourcePurpose
Azure Key VaultCentralized secrets management and encryption key storage
Managed IdentitiesSystem-assigned identities for AKS cluster and workload identity federation
Private EndpointsSecure, private network access to Azure PaaS services (Storage, ACR, PostgreSQL, Key Vault)
SSH Key PairGenerated SSH key pair for secure VM access (stored in Key Vault)
Role AssignmentsRBAC permissions for AKS to pull from ACR and access Key Vault
Workload IdentityOIDC federation enabling Kubernetes service accounts to authenticate with Azure AD

Observability

ResourcePurpose
Log Analytics WorkspaceCentralized repository for logs, metrics, and monitoring data

Phase 3: AI Model Deployments (Optional)

The AI model deployment phase provisions Azure OpenAI services. This phase is optional and only needed if you want to use Azure-hosted AI models.

ResourcePurpose
Azure OpenAI ServicesAzure Cognitive Services for OpenAI model deployments (GPT-5, GPT-4, embeddings models, etc)
Azure AI ApplicationApplication registration and managed identity for AI service access control
Private DNS ZonePrivate DNS zone for Azure OpenAI (privatelink.openai.azure.com)
Private EndpointPrivate network connectivity to Azure OpenAI services
VNet LinkLinks OpenAI private DNS zone to AKS virtual network
Alternative AI Providers

Azure OpenAI Services are optional. AI/Run CodeMie supports other external AI providers:

  • AWS Bedrock: Direct integration with api.openai.com
  • GCP VertexAI: Integration with Anthropic's Claude models
  • Any Other Providers: Any LLM API endpoint that can be integrated with LLM Proxy

If using external AI providers or other models, skip Phase 3 entirely.

Next Steps

Proceed to the next step to deploy the infrastructure:

Manual Deployment

For advanced users or custom scenarios, manual Terraform deployment is possible but not documented. The scripted approach handles all prerequisites, variable management, and deployment orchestration automatically.