Digest-pinned, health-gated deploys on AWS Graviton

By Hifsul · 2026-11-15 · 3 min read

A deployment pipeline is only as good as the worst day it has to handle. For a four-product B2B SaaS suite running on AWS Graviton (ARM64) servers, I wanted releases that were boring: the same steps every time, a clear record of what is running, and a fast way back when something goes wrong. This is how that system is put together and the problems that shaped it.

Never build on the production server

Production ran on ARM64, while development machines were x86. The tempting shortcut is to build images on the server itself, because then the architecture matches for free. The problem is that an image build is one of the heaviest things a small server will ever do. It competes for memory with the apps that are serving customers, and a big enough build can push the whole box over.

So the servers became pull-only. Images are built on a separate native ARM64 build machine that starts when a build is requested and stops itself after a period of idle time, so it costs nothing when nobody is releasing. Production servers only ever pull finished images.

Pin images by digest, not by tag

Tags like latest or main move. If two servers pull the same tag a few minutes apart, they can end up running different code and nobody can tell from the outside. Every image is pushed to Amazon ECR and deployed by its exact digest. The digest is the identity of the release: it is what gets recorded, compared and rolled back to.

deploy  <app> <image digest>   → move every container of the app to exactly this image
verify  <app>                  → confirm what is actually running, container by container
rollback <app>                 → return to the last good digest

Deploy over Systems Manager, not SSH

Deploys run through AWS Systems Manager. Nobody needs SSH access to production to ship a release, there are no long-lived keys on laptops for this purpose, and every command that runs on a server goes through one audited channel.

An app is several containers, and they must move together

This was the most important lesson. A Django product here is not one process: it is a web container, a websocket (ASGI) container, a background worker and a scheduler, all built from the same image. If a deploy updates the web container but misses the worker, the release looks successful. The website shows the new version, health checks pass, and the background jobs quietly keep running the old code.

The fix was to list every service of every app explicitly, and to make the deploy refuse to run if any of them cannot be moved to the new image. After a deploy, every container of the app must report the same image id. A deploy that cannot guarantee that is not allowed to report success.

Health gates and one-step rollback

A release only counts once health checks pass on the new containers. Verification runs automatically after the deploy, and rollback is one command back to the previous digest. Because the digest is recorded, "what was running before" is never a guess.

Make sure CI runs what the repository says

The deployment scripts live in git. CI, however, ran a copy of them stored separately. That creates a quiet failure mode: a bug fixed in the repository can keep living in the copy that actually deploys. A read-only drift check now compares the two, and it is the first thing to run whenever a deploy behaves differently from the code you are reading.

What I would tell another team

  • Keep builds off production servers, however convenient it looks.
  • Treat the image digest as the release identity.
  • Write down every process an app runs, and make the deploy prove it moved all of them.
  • Gate releases on health checks and keep rollback to one step.
  • Check that the pipeline that runs is the pipeline you reviewed.

Related

All articles · Start a project