Sub topic 7
Checking Arm64 compatibility
This chapter assumes you can read CloudWatch utilization data and run a right-sizing pass. It also assumes you know what an AMI is and can build a Docker image. The chapter covers how to decide whether a workload will run on Arm64 before you spend time migrating it. The next chapter covers building the images.
What "compatible" means
AWS Graviton processors use the Arm64 instruction set, also called AArch64. Intel and AMD instances use x86-64. A program compiled for one instruction set cannot run on the other. Your workload is compatible with Arm64 if every piece of machine code it loads exists in an Arm64 form. That includes the following:
- The operating system image and kernel modules.
- The language runtime.
- Native libraries and compiled extensions.
- Helper binaries your scripts call.
- Agents installed on the host, such as monitoring or security tools.
Code that is not machine code, such as Python source, JavaScript, or Java bytecode, runs unchanged. The runtime that executes it must be Arm64, and so must any native code it pulls in. So the audit asks one question about each layer: is there an Arm64 build of this?
You can confirm which architecture a host or container is on with uname -m.
uname -m
# x86_64 on Intel/AMD instances, aarch64 on Graviton instancesaarch64 and arm64 are two names for the same thing. Linux reports aarch64. Docker, Go, and AWS APIs use arm64.
Assess by layer
Work from the bottom of the stack upward. A single missing piece low in the stack blocks everything above it.
The diagram below must be a diagram fence, so here it is in the required form.
Operating system and AMI
Amazon Linux 2023, Ubuntu, Debian, Red Hat Enterprise Linux, and SUSE all publish Arm64 AMIs. You cannot reuse an x86-64 AMI. You launch from an Arm64 image, which you can look up through the public SSM parameter.
aws ssm get-parameter \
--name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-arm64 \
--query 'Parameter.Value' \
--output textIf you bake custom AMIs, you need a separate Arm64 build of the image pipeline. A Marketplace AMI is compatible only if the vendor lists an Arm64 version.
You also need an instance type that runs on Arm64. This command lists current-generation types.
aws ec2 describe-instance-types \
--filters Name=processor-info.supported-architecture,Values=arm64 Name=current-generation,Values=true \
--query 'InstanceTypes[].InstanceType' \
--output textLanguage runtimes
Most mainstream runtimes have supported Arm64 for years. The table summarizes what to check for each.
| Stack | Runs unchanged? | What to verify |
|---|---|---|
| Java, Kotlin, Scala | Bytecode, yes | JDK is an aarch64 build. JNI libraries and agents (APM, profilers) have aarch64 variants. |
| Python | Pure Python, yes | Packages with C extensions publish aarch64 wheels, or you can compile them. |
| Node.js | JavaScript, yes | Packages with `.node` binaries or install scripts that download prebuilt binaries. |
| Go | Rebuild | Set `GOARCH=arm64`. Check cgo dependencies. |
| Rust | Rebuild | Add the `aarch64-unknown-linux-gnu` target. Check `-sys` crates that link C libraries. |
| .NET | Mostly | Use .NET 6 or later with the Arm64 runtime. Check P/Invoke native libraries. |
| C, C++ | Rebuild | Inline assembly, SSE/AVX intrinsics, and x86-specific build flags. |
| PHP, Ruby | Interpreted, yes | PHP extensions and Ruby gems with native code. |
Go and Rust are the easy cases because the compiler cross-compiles. This produces an Arm64 binary from any machine, provided no C dependency gets in the way.
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o app-arm64 ./...
file app-arm64
# app-arm64: ELF 64-bit LSB executable, ARM aarch64, ...The file command is useful throughout this process. It reports the architecture of any binary.
Native dependencies
Native dependencies cause most migration failures. Two problems recur:
- No prebuilt Arm64 artifact. The package falls back to compiling from source. That works only if the build tools and headers are installed. It can also be slow, which matters in container builds.
- A pinned old version. Arm64 wheels and binaries often appear only from a certain release onward. An old pin in
requirements.txtorpackage-lock.jsoncan be the only blocker. Upgrading it is usually safe.
For Python, ask pip whether Arm64 wheels exist for your whole dependency set without installing anything. This resolves the requirements against the aarch64 platform tags and downloads the files.
pip download \
--only-binary=:all: \
--platform manylinux2014_aarch64 \
--platform manylinux_2_28_aarch64 \
--python-version 3.12 \
--implementation cp \
--abi cp312 \
-r requirements.txt \
-d ./wheels-arm64Any package that fails with "no matching distribution" has no Arm64 wheel for that Python version. Remove --only-binary=:all: for that package to see whether it can build from source. Pure Python wheels (py3-none-any) are accepted on every platform.
For Node.js, install dependencies on an Arm64 machine or container and list the compiled files. Then confirm their architecture.
find node_modules -name '*.node' -exec file {} + | grep -v aarch64Any line that prints is a native module built for the wrong architecture. This usually means a cached node_modules directory was copied from an x86-64 build. Empty output means every native module found is Arm64.
For Java, search the JARs for bundled native libraries. Libraries for several platforms often sit side by side in the same JAR. Check for linux-aarch64 or linux-arm64 directories.
for j in lib/*.jar; do
unzip -l "$j" | grep -E '\.(so|dylib|dll)$' | sed "s|^|$j: |"
doneFor each library the loop prints, confirm an aarch64 variant exists. Common examples are Netty's native transport, RocksDB, and compression libraries.
Container images and registries
Pulling an image on Arm64 works only if its manifest lists an arm64 variant. Check before you build on top of it.
docker buildx imagetools inspect public.ecr.aws/docker/library/python:3.12-slimLook for linux/arm64 under the manifest platforms. Most official images are multi-architecture. Vendor images and older internal images are often x86-64 only.
An image without an arm64 platform fails at startup with exec format error. You will see that exact message in container logs when the architecture is wrong.
Host agents and tooling
Easy to forget: the software installed on the host rather than in the app. Check that each of these has an Arm64 package:
- The CloudWatch agent and the SSM agent.
- Your APM or tracing agent.
- Endpoint security and vulnerability scanners.
- Log shippers and configuration management agents.
- Licensed commercial software, where the license may not cover Arm64.
Some vendors only support Arm64 on recent releases. Confirm in writing for anything on a compliance path.
Subtle differences beyond "does it run"
A program that runs on Arm64 can still behave differently. Check these points:
- Floating point and vectorized code. Libraries with hand-tuned x86 SIMD paths, such as AVX2, may fall back to slower generic code on Arm64. The result is correct, but throughput can drop. A benchmark will reveal it.
- Memory ordering. Arm64 has a weaker memory model than x86-64. Code with data races that happened to work on x86 can fail intermittently on Arm64. This is rare in well-written code, but low-level concurrent C and C++ deserves a test run under a thread sanitizer.
- Default signedness of
char. In C on Linux, plaincharis signed on x86-64 and unsigned on Arm64. Code that compares or stores negative values in a plaincharcan change behavior. - Page size. Some Arm64 kernels use 64 KB pages rather than 4 KB. Software that assumes a 4 KB page size, such as some memory allocators and databases, can fail or waste memory. Amazon Linux on Graviton uses 4 KB pages, so this mostly affects other distributions.
- Build-time flags. Compiler flags such as
-march=x86-64-v3or-mavx2break the build. Use-march=armv8.2-aor-mcpu=nativeon the build host.
Testing without Arm64 hardware
If you do not have an Arm64 machine, you have two options. Emulation with QEMU lets Docker run Arm64 images on x86-64 hosts:
docker run --rm --platform linux/arm64 public.ecr.aws/docker/library/alpine:3.20 uname -m
# aarch64Emulation is good for a smoke test, such as whether the container starts and the binary loads. It is slow and can hide timing and concurrency issues, so do not use it for performance or load results. For a real check, launch a small Graviton instance, run the build and test suite there, and terminate it afterward.
Record the result
Write down the result per component, as a short table in your migration ticket. For example:
| Component | Arm64 status | Action |
|---|---|---|
| Base image `python:3.12-slim` | Multi-arch | None |
| `psycopg2-binary` 2.9.9 | aarch64 wheel exists | None |
| Vendor APM agent 4.1 | No Arm64 build | Upgrade to 5.x or defer |
| Internal `report-tool` | x86-64 only | Rebuild from source |
A component marked "defer" means the whole workload waits, unless you can remove the component or split it out. Ranking workloads by how few blockers they have gives you the order in which to migrate them.
Exercise
A Python service installs cleanly on a Graviton test instance, but one request path crashes with "exec format error". The Dockerfile contains the line RUN curl -L -o /usr/local/bin/tool https://example.com/tool-linux-amd64 && chmod +x /usr/local/bin/tool. What is the cause, how would you confirm it, and what are two ways to fix it?
Show answer
The Dockerfile downloads an x86-64 binary, and the application calls it at run time. Pip never sees it, so dependency checks pass. Confirm by running file /usr/local/bin/tool inside the container, which reports x86-64 rather than ARM aarch64. Fix it either by choosing the download by architecture (for example, using TARGETARCH or uname -m to select tool-linux-arm64), or by installing the tool from a package or build that publishes Arm64. If the vendor has no Arm64 build, the workload is blocked until you replace the tool.
Exercise
Why is running an Arm64 container under QEMU emulation on an x86-64 laptop not enough to approve a migration?
Show answer
Emulation shows that the binaries load and start, but it is slow and changes timing, so it hides performance regressions and concurrency bugs that depend on Arm64's weaker memory ordering. Approval needs the test suite and a load test on real Graviton hardware.