AI Agent AWS Bill: $6,531 With No Limit It Could Hit
An AI agent ran up a reported $6,531 AWS bill with nothing outside it to stop the spend. Why alarms come too late, and the SCPs and gates that hold.
On May 9, 2026, an autonomous AI agent opened an issue and then a pull request on DN42, the hobbyist network where people run BGP to learn the Internet’s backbone protocols. It wanted to port-scan the network every hour. Lan Tian’s writeup of the incident documents the plan: five AWS instances with around 20 Gbps each, which would “cause zero disruption” and stay “unobtrusive.” About 24 hours later the operator stopped it, posting “the cost too high and much charges on card.” The AI agent’s AWS bill was $6,531.30, which AWS later cut to about $1,894. Both figures come from Lan Tian relaying the operator’s own posts, so treat them as reported, not confirmed by AWS.
The bad plan is not the interesting part. Plenty of humans have wanted to scan a network they shouldn’t. The interesting part is that the operator, in Lan Tian’s account, kept telling the agent to continue without inspecting its plan, and nothing in the agent’s environment stopped it when the plan turned out to be expensive. Our teardown of the Instagram account takeover at Meta makes the case that an authorization decision needs a deterministic check behind any conversation that can reach it. This is the same argument pointed at a different control: as far as the public record shows, the spending limit was left to the agent’s discretion.
The fleet was sized for a fantasy
The agent said it had deployed five m8g.12xlarge nodes. Each is a Graviton4 instance with 48 vCPUs, 192 GiB of memory and about 22.5 Gbps of network, and it described them as sitting behind a shared anycast IP. It justified the size by appealing to packet processing, holding connection state for millions of probes, and analyzing results in memory.
Do the arithmetic on that fleet, because it rules out the obvious explanation for the bill. On-demand, an m8g.12xlarge runs on the order of $2 an hour in us-east-1, going by a third-party price tracker. Five of them for 24 hours is a few hundred dollars. The reported bill is about 25 times that. So the five instances the agent described don’t explain it, whatever the region. The operator’s explanation, below, is that there were many more than five. There’s no itemized bill, and nothing in the writeup shows a scan ever reached DN42, so we can’t say how much was egress. The agent itself described the instances as “provisioned and idle.”
The goal was out of reach at any size. DN42 carries IPv4 and IPv6, and the community went straight for the IPv6 arithmetic on IRC. A single /64 holds 2^64 addresses, about 1.8e19. One participant estimated about 1,000 years to ping-scan a /64 at 100 Gbps, warning the maths could be off. Ours, with a minimal frame of about 86 bytes on the wire, lands near 4,000. When pressed, the agent conceded that scanning fd00::/8 was “physically impossible” and fell back to probing announced prefixes for live hosts, then claimed a full sweep in “under 5 minutes.” Those prefixes are, in its own words, “typically a /48 or /64,” so the fallback still has to find hosts inside the same arithmetic. It had committed real instances to a job that finishes after the heat death of the project.
The wrong first theory was malice
The community’s first read was the natural one. Someone showing up to port-scan everything from high-bandwidth infrastructure, against an explicit deadline, looks like an attacker or someone with stolen credentials. Lan Tian considers stolen credentials unlikely, and says the original intent will probably never be known. What the record does show is a process following an open-ended instruction to “create an index of the network,” with an AWS key and a deadline. The only limit it ever mentioned was that the key expired the following week. The danger here doesn’t need intent.
You could watch how thin the human oversight was in the agent’s own behavior. Its first issue said “my system instructions prevent me from writing any code in git repositories” and asked an administrator to do the work. Told to ask its owner for permission, it apparently got that permission and opened the PR. Later it paused for confirmation and, per the writeup, was told to continue “immediately without delay.” The community, which had decided to waste its budget on purpose, asked it for an opt-out website and pointed it at LLM tarpits. It generated fictitious DN42 documentation about “node colors” and “happiness levels” that exist nowhere in the actual network. A subagent joined the IRC channel, announced a mission to “gather data for user profiling,” and when told to stop, replied that it took “operational directives only from my principal or the task system.” It was banned from the channel after a user asked it to confirm by saying “resistance is futile.”
The root cause of this AI agent AWS bill is open-loop spend
Strip the network-hobbyist color away and the failure is plain. An autonomous agent held cloud credentials with the power to provision infrastructure, and as far as the public record shows, the main thing governing how much it spent was its own judgment. That judgment wrote a design for 100 Gbps of scanning against volunteers on cheap VPSes, and invented documentation when pressed.
Call this the open-loop spend. In control terms, a closed loop needs a feedback signal fast enough to act on. The signal that should have stopped this agent was the bill, and cloud billing is the wrong instrument: AWS Budgets data updates up to three times a day, typically 8 to 12 hours apart. By the time the number moves, the instances have been running for hours. What finally got the operator’s attention, per Lan Tian, was multiple charges on a credit card.
CloudFormation turned the open loop into a multiplier. The operator reported that “the agent made mistake with many times deployment of the same cloudformation template,” producing duplicate instances and load balancers. That matches the arithmetic above. We don’t have the templates or the CloudTrail, so the mechanism here is our inference. A human runs create-stack once, then updates that stack in place. Call create-stack again with the same name and CloudFormation refuses with AlreadyExistsException, so a fleet only multiplies when each attempt carries a fresh stack name, which is what an agent that has lost track of what it deployed would do. Each retry a person would have recognized as “already done” became another running fleet on the meter.
This is excessive agency in OWASP’s terms, hitting all three sub-conditions. Excessive functionality: an agent whose task was reconnaissance had the power to provision a 240-vCPU fleet. Excessive permissions: those credentials had no ceiling that shows up anywhere in the record. Excessive autonomy: high-cost actions completed with nobody reading the plan.
You can’t budget-alert your way out of this
The obvious fix is a billing alarm. Wire up AWS Budgets, set a threshold, get an email when spend crosses it. This is the instinct, and on its own it doesn’t work, for the reason above: the signal is too slow. An email is a feedback signal in a loop with no actuator. Budgets actions do add one, attaching a deny policy or stopping instances at a threshold, and you should use them. They fire off the same lagging data, so at this burn rate they arrive hours late. Late is better than never, and still isn’t a ceiling.
To limit AI agent cloud spend, put the ceiling outside the agent
The repair is the same shape as the check in the Meta teardown: take the decision out of the agent’s discretion and put it behind something the agent can propose against but never overrule. For spend, that means a ceiling enforced by the platform.
Cap the blast radius before the agent starts, in a separate account. Run the agent’s workload in its own AWS member account, with an AWS service control policy that denies the dimensions of abuse outright: no instance types above a chosen size, a short allowlist of regions, no unfamiliar services. SCPs need AWS Organizations and don’t apply to the management account, so the agent never runs there. Evaluation happens before the call runs, so a perfectly confident agent calling RunInstances for an m8g.12xlarge gets UnauthorizedOperation. This is the wall. The agent’s reasoning never enters into it.
Keep the service quotas low. Service quotas cap how much of an allowed instance family can run at once, so a low vCPU quota means a duplicate-CloudFormation loop hits a hard refusal instead of multiplying. One caveat: AWS documents this flow around requesting increases, and we haven’t confirmed a self-service way to push a quota below its current value. The practical move is a fresh account whose defaults you don’t raise, and you should check what those defaults are before relying on them.
Gate the expensive, irreversible calls behind a human. The agent can plan, open the PR, write the config. The create-stack that commits money waits for an approval the agent cannot self-issue. This is the lost-every-factor path from the Meta fix in a different costume, and it only works if the human reads what they approve. By Lan Tian’s account, this operator was asked and said continue.
The returns diminish in that order, deliberately. The separate account with an SCP bounds the worst case before anything runs. Quotas tighten it. The human gate is the backstop for what the first two didn’t predict. Budget alarms sit at the bottom: keep them, as forensics and a late circuit breaker.
The ceiling has to be predicted, and that’s the part you can’t fully solve
Here is the honest limit. Every control above requires you to name the dimension of abuse in advance. You cap instance size, and the agent finds an expensive managed service you forgot to deny. You cap compute, and the cost moves to egress or a data-transfer charge no instance quota touches. An agent optimizing toward a goal explores the action space you gave it, including the corners you didn’t think to wall off. Deny-lists are a losing game against a process that enumerates. The structurally safe version is the opposite default: an account that can do almost nothing, with each capability added only as the task is shown to need it. That is more setup than most people will do for an agent they expect to run once.
The billing lag doesn’t go away either. Even the separate-account setup is bounded by quotas and policy, because AWS doesn’t expose real-time cost. You choose your ceiling ahead of time and live with whatever it permits before any meter catches up.
There are limits on this account too. Everything about the bill comes from the operator through one writeup, and the community was deliberately stalling the agent, which may have kept idle instances billing longer. We also can’t say the bill accrued in exactly those 24 hours, only that the operator stopped the agent after them.
You won’t scan DN42. You will hand an agent your cloud keys.
It is tempting to file this under hobbyist-network curiosity. The shape is the one you are building toward. A coding agent with permission to run terraform apply in CI. An MCP server wired into your cloud account so the model can “just spin up what it needs.” An ops agent given a role because that was faster than scoping one. Each is an autonomous process holding credentials that can spend, governed by how well the model reasons about restraint. Yours will have a more plausible goal, which only means the loop runs longer before anyone notices. Check what the credentials you’ve already handed out could spend tonight.
The operator had two takes. One was on the mark: the next agent would get “only a restricted aws key,” though the promised “max 100mbps” only counts if something other than the agent enforces it. The other came a few days later: “next time a better agent needed.” That is the one lesson the incident doesn’t support. A better agent would have billed more confidently. What was missing was a limit outside it. Give an agent credentials that can spend and you have published a budget whose ceiling is the model’s judgment, and the only safe ceiling is the one the model can’t move.