I recommend Fargate.
In ECS Fargate or Kubernetes: what does a normal application really need? I wrote that I start a normal application on ECS and only move to Kubernetes once it pays off. Still, I did a move from ECS to EKS, and Claude Code wrote most of the code for it.
It went quickly. But not because the agent made no mistakes. It went quickly because no mistake could get expensive: I had split the project up beforehand so that every step could be checked and taken back.
Why leave Fargate when I recommend it
Fargate was not the problem. The reason was a shared platform: several applications were supposed to run on one cluster, instead of each bringing its own environment with its own roles, its own network and its own deployment. That is exactly the case where I recommend Kubernetes in the ECS article.
You do not get it for free. On Fargate every application belongs to itself. On a shared cluster it shares nodes, quotas and identity rules with others, and somebody has to look after the platform.
None of that changes my recommendation. If you run a single, normal application, ECS on Fargate is leaner and cheaper, and I would set it up that way again today. So please do not read this article as an argument for moving. It shows how to move when you have a reason.
What a cluster means for a system that has grown over the years is covered in Does the legacy application belong on Kubernetes?.
Decisions first, then tasks
I never wrote "migrate this to EKS" to the agent.
I started with a list of decisions, before any agent was involved: Where do the images live? Who may read what? Where do the secrets come from? How do we switch over, and how do we get back? Only once that was answered did I cut the project into parts:
- Cluster foundations: namespace, registry, identities
- Secrets
- Image publishing
- Observability
- Cutover
- Rollback rehearsal
- Tearing down the old platform
Each part was small enough for a single agent run and had its own specification. It is the same process I describe in Eight steps, not a prompt: how I work with coding agents, only this time for a platform instead of a feature.
Every specification said what the part delivers, what is not part of it, which command I use to accept it, and how I get rid of it again. The acceptance command mattered most. "The chart renders" is not enough for me. "The render check is green, and the chart installs into an empty namespace" can fail, and that is what counts. Asking about the way back kept me from building anything that can later only be removed by hand.
Why so small? An agent given "the migration" makes a hundred decisions along the way, and I never see most of them. Given "the identities for the namespace" it makes three, and all three are in the specification.
One switch per job
What moved were scheduled jobs and one service with long-lived connections. For the jobs I built a switch, one per job, with four positions:
jobs:
invoice-run:
platform: probe # old | probe | both | new
schedule: "10 * * * *"
report-mailer:
platform: old
schedule: "0 6 * * *"old: The job runs on the old platform only.probe: The job also runs on the cluster, but only as a preview. I see whether rendering, secrets and health are right. What it does there does not count.both: The job runs on both sides.new: The job runs on the cluster only.
I switched in blocks, the harmless jobs first and the touchy ones last. For a job whose missed run hurts nobody, the new platform may make its first mistakes.
I like two things about the switch. Where a job runs is written in exactly one place. And whoever moves it changes one line that somebody can review. Going back works the same way: one line.
A job only moved on once it had proved something. It left probe only when the trial run had rendered cleanly, found its secrets and reported healthy. It left both only when both sides delivered the same result.
The both position was not planned. It was added after a mistake. When a merge goes through, two things start at once: the Terraform apply that removes the job on the old side, and the GitOps bump that creates it on the new side. They never finish at the same moment. If you jump straight from old to new, there is a window in which the job either runs nowhere or runs on both sides.
With both, the job runs twice in that window on purpose. I would rather have it run twice than not at all. That only holds for jobs that can stand a second run, though. A job that sends mail on every run or raises a counter cannot. It needs something else, such as a lock or a time limit inside the job itself, and that has to be in the specification before the first job goes to both.
Prove the hardening on the old platform
On the cluster the image should not run as root, and the file system should be read-only. I switched both on before anything moved, while still on ECS. There they are two settings in the task definition. On the cluster they belong in the security context.
The reason is simple: I wanted to change only one thing during the move. You cannot know beforehand whether an image still starts after hardening like that. Somewhere something writes to a path nobody documented, and you only notice when the file system says no. If that had happened together with the platform change, every error would first have raised the question of whether the cluster or the file system was to blame.
That is also why the Dockerfile sets no fixed user. The platform decides: on ECS the task definition, on the cluster the security context. So it stays the same image on both sides.
What only the cluster showed
Manifests, a chart with values per job, Terraform for identities and registry, tests for the rendering: the agent wrote all of that, quickly and tidily. It was also the easy part.
The following five problems were in no diff. Only the running cluster found them.
Identity: the pod ran with the wrong role
The application gets its permissions through a profile chain of the AWS SDK. It starts with the container's credentials and switches from there into the actual role:
[profile target]
role_arn = arn:aws:iam::111111111111:role/application-target
credential_source = EcsContainerOn ECS the profile file and the profile name reached the container through the task's environment. The chart had neither. So the pod ran with the role that EKS Pod Identity gives it, never switched into the target role, and every AWS call ended in AccessDenied.
The name EcsContainer is a false lead. It sounds as if this only works on ECS. But it means the SDK's container credential provider, and Pod Identity serves that one just the same. As soon as the profile file and the profile name were in the chart, the chain worked.
Quota: full, with nothing running
A ResourceQuota with count/pods limited the namespace. At some point new runs were rejected because the limit had been reached. Nothing was running at that moment.
The explanation: every CronJob keeps the pods of its latest runs, and they counted. The Kubernetes documentation explicitly excludes finished pods for the key pods. For count/pods that sentence is not there, and in my case the key counted them.
Evictions: runs that were simply gone
Karpenter replaced nodes because of drift while jobs were running on them. The jobs were aborted, and because they were configured with backoffLimit: 0, nobody restarted them. The runs were simply missing.
An annotation on the pods helped:
spec:
jobTemplate:
spec:
backoffLimit: 0
template:
metadata:
annotations:
karpenter.sh/do-not-disrupt: "true"According to the Karpenter documentation, Karpenter leaves nodes with such a pod alone during consolidation and drift. The annotation does not help against forced interruptions, that is, when a node expires or a spot instance is reclaimed. A job that really must never be lost therefore has to be able to pick up again after an abort.
Requests: own machine versus shared node
On Fargate every task has its own machine. If you calculate memory tightly there, you rarely notice. On the cluster, pods share a node, and that is where I noticed: for one large job I had set the memory request at p95 instead of the peak. On its own it would just about have worked. With neighbours on the same node it no longer did.
Since then, large jobs get the measured peak as their request.
Readiness: the service that said "not ready"
The service with the long-lived gRPC connections reported NOT_SERVING through the standard health check. The check also tests a dependency, and the pod lacked a permission for that. On ECS nobody had ever noticed. On the cluster, though, readiness decides whether a pod gets any traffic at all.
The second topic with this service was shutdown. A long-lived connection never ends by itself, so a graceful stop without a time limit waits forever. It now has a limit of a few seconds.
I cannot blame the agent for any of these five mistakes. I would have built them in by hand just the same, and the one with p95 I did build in myself. What mattered was that every finding cost only minutes: switch back, fix the error, go forward again.
For the next specification I have therefore written down one question: what changes in the environment without the code seeing it? Identity, limits, restarts, shared resources, and what the application tells the platform about itself. The list does not catch everything. But what it catches, I find before the switch and not after.
Rehearse the rollback, secure the teardown
I tried the way back once before I needed it. That means I really switched back, waited until the old side took over the runs alone again, and checked whether anything had run twice or not at all. A rollback that nobody has ever run is only an assumption.
When tearing down the old side, I nearly tripped myself up. The secret seeding on the new side still read its values from the old one, and the teardown would have taken them along. There is now a guard that blocks the teardown as long as the new side still depends on the old one.
I muted the old monitors and did not delete them. I can undo muting, but not deleting. They go away once the new ones demonstrably work.
I also hard-wired two more things. In CI, a check renders the chart and rejects any release that contains an unwanted hook. And I deliberately start database migrations as a job of their own. As a sync hook they would run on every reconciliation, even when nobody is looking.
What I would do the same way again
Most of it.
The list of decisions at the start is quickly written, and after that no agent run has to guess what was meant. I would build the switch with its in-between positions again, because the trial run and the double run find exactly the mistakes no test sees. And I would again harden first and then move.
When to switch is still my decision. The agent may propose blocks and prepare the diff. Whether a block is ready is decided by whoever answers for an outage.
I did not try to train the agent out of making mistakes. I made sure they stay cheap.
How to introduce a way of working with coding agents in a team is covered under Introducing Claude Code.

