Explore Caylent’s Activities at AWS re:Invent

ARM-Based AWS Lambda with Graviton2: What Developers Need to Know

IoT
Cost Optimization

Two technical edge cases when migrating AWS Lambda to ARM/Graviton2: floating-point comparison precision and undefined C behavior with negative float casting. Learn migration considerations.

This blog was originally written and published by Trek10, which is now part of Caylent.

The announcement of Graviton2 support for AWS Lambda, which boasts up to 19 percent better performance at 20 percent lower cost compared to its x86-based predecessor, has left many of us wondering “great, so what’s the catch?”

For the vast majority of developers, there is no catch—almost everything should “just work.” In this brief post though, we will walk you through a few possible issues you could encounter and how to deal with them.

A typical use-case for AWS Lambda is running a relatively simple procedure written in a high-level programming language, with perhaps a few external packages installed, that finishes its execution in milliseconds. Everything within the standard library of a high-level programming language, such as Python, should work out of the box. Additionally, nearly all commonly used packages within these ecosystems have already been ported to arm architectures.

The only circumstances in which you, as a developer, might (emphasis on the might) run into an issue with Graviton-based AWS Lambda include floating point comparisons and converting floats, with relation to these operations being performed within portions of imported packages that make calls to native C/C++ code.

The first potential issue, floating point comparisons, should be of little consequence. In short, float values determined within one architecture may slightly differ with the values determined by another. Mathematically speaking, the two values might be equivalent to one another, but when comparing them programmatically, i.e. float_from_x86 == float_from_arm, you may get “false” as a result. Again, for most use cases this limitation is completely irrelevant, but if you are putting incredibly precise workloads on AWS Lambda, it might be a good idea to review which numerical datatypes you are using and ensure appropriate levels of rounding are occurring.

The second issue, in regards to converting floats, pertains to undefined C behavior:

In the event that you are casting a negative float to an unsigned int, you will likely arrive at different values across architectures. However, developers can audit their code to find out where this is happening:

The first image displays an example of casting a float as an unsigned int, on an x86-based platform. The second image displays that, when compiling with the -fsanitize flag, the compiler will notify you that you are entering dangerous territory. However, with this flag omitted, -2.7 becomes 4294967294.

In contrast, when running this same code (with an additional printf to make the “0” more obvious in the picture) on an arm-based EC2 instance, we can observe that the resulting value is 0, not 4294967294.

I hope that this short article helps to clarify that, for developers, using ARM-based AWS Lambda should be an easy transition with only minor pitfalls that should not affect most of us. In the event that your AWS Lambda function is experiencing float-related problems, the two “gotchas” mentioned above may be the cause of your trouble.

IoT
Cost Optimization
Trek10 Team

Trek10 Team

Founded in 2013, Trek10 helped organizations migrate to and maximize the value of AWS by designing, building, and supporting cloud-native workloads with deep technical expertise. In 2025, Trek10 joined Caylent, forming one of the most comprehensive AWS-only partners in the ecosystem, delivering end-to-end services across strategy, migration and modernization, product innovation, and managed services.

View Trek10's articles

Learn more about the services mentioned

Caylent Catalysts™

IoT

Connect, understand, and act on data from industrial devices at scale to improve uptime, efficiency, and reliability across manufacturing, energy, and utilities.

Caylent Services

Managed Services

Reliably Operate and Optimize Your AWS Environment

Caylent Services

Infrastructure & DevOps Modernization

Quickly establish an AWS presence that meets technical security framework guidance by establishing automated guardrails that ensure your environments remain compliant.

Accelerate your cloud native journey

Leveraging our deep AWS expertise

Get in touch

Related Blog Posts

Serverless Architectures: IoT

Explore how serverless architectures power IoT applications — from event‑driven design and scalability to AWS services like Lambda, IoT Core, and real‑time processing — for efficient, reliable connected systems.

IoT

Security Profile of IoT Devices

Learn how IoT devices differ from traditional IT systems in risk and behavior, and explore key security practices — including authentication, monitoring, and AWS IoT tools — to protect connected devices from threats and unauthorized access.

IoT

Three Cost-Effective Design Patterns for AWS IoT Data Ingestion

Reduce AWS IoT data ingestion costs by 68% with Amazon Kinesis batching vs AWS Lambda alone. Compare Amazon SQS and Amazon Kinesis patterns for cost, retention, and propagation delay.

IoT