AWS Builder Center

Testing Lambda on Graviton: a one-line change with a noticeable cost difference

I switched a couple of practice Lambda functions from x86 to arm64 to see what the promised savings actually looked like, and hit one native-dependency snag along the way.

I'd read about Graviton  savings before but never actually tested it myself, so I picked a couple of functions from a personal project to try switching.

The switch itself

Changing the architecture from x86_64 to arm64 in the SAM template was a one line change, following the Lambda runtimes documentation : just adding arm64 under the function's Architectures setting in the Globals section.
The next deploy broke right away: one function used a Python library with a native extension compiled only for x86, and the error message said nothing about architecture, so it took me a while to connect the dots.

Fixing the dependency

I had to recompile the layer inside an arm64 container using AWS's own Lambda base image, running the pip install step with the right platform flag instead of on my regular (x86) laptop. After that, the function ran fine on the new architecture.

What I found

Running the migrated functions for a couple of weeks, the cost for that small slice of my project dropped noticeably, with no visible performance loss, and execution time even improved a bit on the more CPU-heavy one (image resizing). AWS's own numbers suggest savings up to around 34% for compatible workloads, which roughly matched what I saw at my (much smaller) scale. The real caution is checking whether a dependency ships an arm64 build before adding it, since debugging a cryptic deploy failure after the fact costs a lot more time than checking upfront.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article