Using Codex CLI, Claude Code, and Gemini CLI for Real World Ops, DevOps, and Platform Engineering
Modern infrastructure is no longer defined by individual servers, scripts, or cloud consoles. It is defined by systems of systems: infrastructure as code, container orchestration, observability pipelines, security automation, compliance enforcement, and increasingly, AI assisted workflows.
Tools like Codex CLI, Claude Code, and Gemini CLI represent a shift from AI that writes code to AI that participates in infrastructure engineering as an operational co pilot. When used correctly, they do not replace human judgment. They compress time to decision, reduce cognitive load, and surface architectural risk before it becomes operational debt.
This article explores how senior engineers and platform teams can use these tools in production grade infrastructure workflows, not demos.
The Role of AI in Infrastructure Engineering
Infrastructure work is fundamentally about state, constraints, and failure modes. Unlike application code, infrastructure changes affect blast radius, data durability, compliance posture, and business continuity.
AI tools are valuable here not because they automate operations, but because they:
-
Analyze large multi file system definitions like Terraform, Helm, Salt, Ansible, CloudFormation, and Kustomize
-
Surface cross layer risks across network, identity, storage, and compute boundaries
-
Simulate change impact before deployment
-
Accelerate incident response and forensic analysis
The key shift is this:
AI becomes a reviewer, explainer, and scenario generator, while humans remain architects, risk owners, and decision makers.
Codex CLI: Infrastructure as Code Engineering at Scale
Codex CLI excels in structured and deterministic systems such as Terraform, Pulumi, Kubernetes manifests, and CI and CD pipelines. It is especially effective in legacy environments where infrastructure evolved organically and now needs governance, standardization, and risk reduction.
IaC Refactoring and Standardization
Example prompt:
Codex can:
-
Identify duplicated modules
-
Normalize variable naming and directory structure
-
Introduce IAM and network boundaries
-
Generate safe migration plans for Terraform state
This is extremely effective when bringing older cloud accounts under proper policy control without a full rebuild.
CI and CD Pipeline Engineering
Codex can design and maintain pipelines that enforce compliance and reliability at the infrastructure level. This includes:
-
Multi stage pipelines for validation, plan, approval, and apply
-
Policy enforcement using OPA, Conftest, and static analysis tools
-
Cost and security gates before production deployment
Example:
This moves governance from human review into automated enforcement.
Real World Example: Migrating Legacy Mail Servers from SpamAssassin to Rspamd
A practical example of Codex CLI in infrastructure work came from modernizing a fleet of legacy mail servers running Postfix and SpamAssassin.
The goal was to migrate to Rspamd for better performance, modern filtering, and tighter integration with milter based workflows.
Using Codex CLI, the workflow looked like this:
Codex helped:
-
Identify where SpamAssassin was hooked into the mail flow
-
Generate the correct smtpd and non smtpd milter directives
-
Normalize socket and port configuration across servers
-
Flag deprecated Postfix parameters that would break on newer releases
It also produced validation steps such as:
-
Socket testing with sockstat and netcat
-
Milter connectivity checks
-
Log verification for message scoring and header injection
This turned what would normally be a multi day audit and trial process into a structured, repeatable migration that could be rolled across servers with confidence.
The key value was not automation. It was risk compression. Codex surfaced misconfigurations and compatibility issues before they reached production mail flow.
Kubernetes Platform Engineering
Codex is highly effective for:
-
Converting raw manifests into Helm charts
-
Building Kustomize overlays for multi region clusters
-
Auditing RBAC sprawl
-
Designing network policies and admission rules
Example:
This positions AI as a security posture reviewer, not just a YAML generator.
Claude Code: Systems Thinking and Failure Mode Analysis
Claude Code is strongest where infrastructure becomes complex and interconnected. It excels at reasoning across distributed systems, security boundaries, and operational workflows.
Architecture Review and Threat Modeling
Example:
Claude Code can:
-
Trace identity trust boundaries
-
Analyze network segmentation
-
Identify hidden service coupling
This is especially valuable for compliance readiness, regulated environments, and acquisition due diligence.
Incident Response and Root Cause Analysis
During outages:
Claude Code can:
-
Correlate signals across metrics, logs, and alerts
-
Draft postmortem documentation
-
Recommend reliability improvements such as retries, scaling rules, and timeout strategies
This reduces mean time to resolution and post incident reporting effort.
Policy and Compliance Engineering
Claude Code is effective at translating governance into enforceable systems. This includes converting:
-
Security and compliance documents
-
Internal engineering standards
-
Regulatory requirements
Into:
-
OPA rules
-
Terraform Sentinel policies
-
CI enforcement logic
-
Audit checklists
This closes the gap between policy and execution.
Gemini CLI: Cloud Native Optimization and Observability
Gemini CLI excels in environments that generate large volumes of telemetry, billing data, and service level metrics.
Cost Engineering and Financial Governance
Example:
Gemini can:
-
Identify underutilized resources
-
Suggest workload tiering strategies
-
Model long term cost trends
This turns AI into a financial visibility layer for infrastructure.
Observability Pipeline Design
Gemini is effective at:
-
Designing OpenTelemetry pipelines
-
Metrics storage architectures
-
Log aggregation systems
-
Tracing and performance analysis
Example:
This is particularly useful for platform teams building internal developer platforms.
Cloud Security Engineering
Gemini can analyze:
-
IAM policies
-
Service account usage
-
Network boundaries
-
Public API exposure
And propose:
-
Zero trust models
-
Identity federation strategies
-
Least privilege enforcement frameworks
Production Workflow: Human and AI in the Loop
A mature AI augmented infrastructure workflow typically follows this pattern:
Design Phase
Claude Code reviews architecture and threat models
Gemini CLI estimates cost and scalability impact
Build Phase
Codex CLI generates and refactors infrastructure as code and pipelines
Validation Phase
AI reviews plans, security posture, and policy compliance
Humans approve risk and deployment windows
Operations Phase
Claude Code assists with incident analysis
Gemini CLI monitors cost and performance drift
Codex CLI maintains infrastructure consistency and code quality
This creates a continuous feedback loop between architecture, deployment, and operations.
What This Is Not
This is not push button infrastructure.
AI does not:
-
Own production risk
-
Understand business impact
-
Make release decisions
-
Carry compliance or legal responsibility
Senior engineers still define:
-
System architecture
-
Security boundaries
-
Reliability objectives
-
Budget constraints
-
Compliance posture
AI removes friction from execution and analysis, not ownership.
Why This Changes Infrastructure Teams
Teams using AI this way:
-
Ship infrastructure changes faster
-
Catch security and reliability risks earlier
-
Maintain cleaner, auditable systems
-
Spend more time on architecture and less on repetitive work
The result is not automation of operations. It is elevation of engineering.
At DevRadius, we use AI augmented infrastructure engineering to combine senior platform engineers with tools like Codex CLI, Claude Code, and Gemini CLI to deliver production grade systems faster, safer, and with full architectural ownership.
We do not sell generated code.
We deliver designed, governed, and scalable infrastructure with AI accelerating the path from architecture to production.