
I Stopped Building AMIs by Hand: What EC2 Image Builder Taught Me About Golden Images
How EC2 Image Builder replaced hand-built AMIs with versioned recipes, tested images, and scheduled patching — so the image running in production is one I can actually defend.
For a long time, my AMIs were folklore. I would launch an instance, install what the app needed, tweak a config file, take a snapshot, and call the result "the golden image." It worked exactly once — the first time. Every time after that, someone would ask which version of the image was running in production, and nobody could answer with confidence. Was it the one with the patched OpenSSL, or the one from before? Did it include the CloudWatch agent, or was that added by hand afterwards?
The honest answer was that I did not know, because the image had no history. It was a snapshot of a Friday afternoon, not a build.
That was when I stopped building AMIs by hand and started using EC2 Image Builder.
A recipe instead of a memory
The change that mattered most was not a feature. It was writing the image down as a recipe.
An image recipe is simple to describe: a base AMI, the components to apply, and the version of the image that comes out. Components are the steps — install a package, copy a config file, run a script — each one versioned, so the recipe is a list of exact versions instead of a vague memory of what I typed into a terminal. I keep the recipe in version control now, next to the application code, which means a change to the image goes through the same review as a change to the app.
The first time I rebuilt an image from a recipe, the result was identical to the previous build. That sounds boring. It is the whole point. A golden image that cannot be rebuilt is not golden — it is a fossil.
The test phase is the part I had been skipping
The second thing Image Builder changed was when I found out an image was broken. Before, I found out in production, when a new instance failed to join the fleet. Image Builder has a test phase that runs before the image is distributed, and that separation turned out to matter more than I expected.
My test components are deliberately simple: does the application service start, does it answer a health check, is the agent I depend on actually running? These are checks I used to do by hand, after the instance was already serving traffic. Now a broken component fails the pipeline, the bad image never gets distributed, and I get the failure in the build log instead of in a 2 a.m. page.
It took me a while to trust the tests enough to stop hand-checking every image. The habit that finally broke was SSHing into a fresh instance just to look around. If the test phase says the image is good, I let it be good.
Patching on a schedule, not on a scare
The third change was the schedule. My old patching rhythm was reactive: a CVE announcement, a rushed rebuild, a hope that I remembered all the steps. An Image Builder pipeline can run on a schedule, so the image gets rebuilt regularly from the latest base AMI and the latest component versions, whether or not anything is on fire.
That regularity changed how I think about patching. A monthly rebuild is a small, boring event. An emergency rebuild is a large, stressful one. The pipeline did not remove the work — it moved it from the worst possible moment to an ordinary Tuesday.
The distribution settings are the quiet detail that makes this safe: the pipeline builds the image in one place and distributes it to the regions I actually use, with the launch permissions I actually need. No more copying AMIs by hand between regions and forgetting one.
What I would tell myself a year ago
If I could go back, I would say three things. First, treat the image like code: version the recipe, review the changes, rebuild from scratch instead of patching a running instance. Second, test the image before it ships, with checks that match what production actually needs from it. Third, rebuild on a schedule, so patching is a routine and not a rescue mission.
I still take snapshots before risky deploys. I still keep the restore drill from the RDS days. But the image underneath it all is no longer a mystery. It has a recipe, a version, and a test result — and the next person who asks which image is running in production will get an answer I can actually defend.
How do you build your images today — by hand, or with a pipeline? And if you could automate one step first, which one would it be?
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article