Skip to content

How I used Codex for a read-only AWS FinOps audit

Published:
•5 min read

On October 23, I asked Codex to review an AWS account in Jakarta and work out how much of its usage was worth committing to. I gave it one constraint: use the AWS CLI to read the account. If the audit recommended resizing a server, deleting a resource, or buying a Savings Plan, put the commands in a separate file for me to review and run myself.

I already had a September report for the same account, prepared using the AWS Core plugin. It had modeled a Database Savings Plan at $7.50 per hour and recommended holding off on additional Compute commitments until rightsizing was validated. For the October audit, I wanted to price what would still be running after the proposed changes. That gave the two reports different starting points.

I’d previously written about using an AI agent for an Alibaba Cloud FinOps audit. This time I used Codex with the aws-billing-and-cost-management skill and an existing AWS CLI profile. I’ve left out account IDs and resource names. No AWS resources were changed, and no Savings Plans were bought.

What I asked Codex to do

My prompt was longer, but this is the part I’d reuse:

Audit AWS spend in Jakarta using read-only CLI calls. Start with monthly costs and existing commitment coverage. Compare EC2 and Aurora inventory with CloudWatch metrics. Estimate savings by resource, then work out what would still run around the clock after the proposed changes. If a metric is missing, say so. Put any change or purchase commands in a separate document for me to run manually.

The skill gave Codex a workflow for Cost Explorer, Compute Optimizer, and AWS pricing. It didn’t grant AWS access or change IAM permissions. Codex wrote a local collector with a list of allowed read operations, saved the AWS responses, and used Python to calculate percentiles and model the savings. I could trace an estimate back to the metric and price that went into it.

The first query came back empty

The RDS Proxy query returned no datapoints. Codex checked the dimensions CloudWatch actually published and found the mistake: it had queried DBProxyName, while the metric used ProxyName. Once it corrected the query, production proxies showed client activity. The development proxy, by comparison, recorded zero client connections across 720 hours. It went on the list for a dependency check before removal.

Two Network Load Balancers looked alike if I only looked at processed bytes. Both showed zero. One also had zero new flows over 30 days. The other had no registered targets and still recorded more than 61,000 new flows. I’d check who was trying to connect to the second one before deciding whether to fix it or retire it.

EC2 had a similar problem. CPU p95 was below 5% on 91 of 111 instances, and memory data was missing for 33. Codex used the available memory data, peak utilization, and Compute Optimizer’s performance risk to narrow the resize shortlist to 32 instances. Those were candidates for a pilot; the audit didn’t show how the applications would perform on the smaller types.

What the audit found

Proposed actionEstimated monthly savings
Retire unused resources after checking dependencies$168
Resize 32 EC2 instances and convert two gp2 volumes to gp3$532
Schedule non-production Aurora clusters and one development EC2 instance$1,334
Add Savings Plans after validating the remaining usage$1,269

The combined scenario came to about $3,300 per month before tax and reconciliation of existing discounts. The biggest item was scheduling. Codex priced the Aurora capacity it observed outside a proposed Monday to Friday, 08:00 to 18:00 Jakarta schedule. The estimate depends on owners confirming that window. Storage and backup charges would continue while the databases were stopped.

Cost Explorer’s 60-day recommendations were about $4.02 per hour for Compute and $6.16 per hour for Database. For the October model, Codex used the proposed EC2 sizes, left out workloads whose 24/7 requirement I couldn’t confirm, and used the configured minimum capacity for production Aurora. That put the targets at $1.29 per hour for Compute and $2.37 per hour for Database, both one year with no upfront payment. I’d wait for measurements after the changes and reconcile the existing discounts with the payer before buying either plan.

Putting the findings in Excel

After reading the report, I wanted a simpler way to go through the findings one by one. I asked Codex to make an Excel tracker. It used the Spreadsheets skill to fill in the current size, proposed size, reason, and estimated savings. I could then filter the rows, mark whether a resource was still in use, and record what I wanted to do with it.

The first version put “Needs checking” in the same category column as “Rightsizing” and “Scheduling.” I asked why that category was there. “Needs checking” tells me where a decision stands, but it doesn’t tell me what resource I’m looking at. I’d keep the resource type, review status, and decision in separate fields. I’d also leave actual savings blank until I can verify them on the bill, even after a resize is marked complete.