Sub topic 7
Checking Arm64 compatibility
This chapter assumes you know basic EC2 concepts, can use the AWS CLI, and are comfortable with Linux and Docker. By the end you will be able to decide whether a workload can run on Graviton (Arm64) and find what blocks it.
Why compatibility comes first
Graviton instances use the Arm64 instruction set (also called aarch64). Intel and AMD instances use x86-64. A program compiled for one cannot run on the other. Code in an interpreted or managed language usually moves without changes. Compiled binaries and native libraries do not.
Check compatibility before you benchmark. A migration that fails at startup wastes the benchmark time.
Confirm what you run today
Start by confirming the architecture of each host or container in your fleet.
uname -m
# x86_64 on Intel/AMD instances, aarch64 on Graviton instancesThen list the instance types that can run Arm64, so you know what you can choose from.
aws ec2 describe-instance-types \
--filters Name=processor-info.supported-architecture,Values=arm64 Name=current-generation,Values=true \
--query 'InstanceTypes[].InstanceType' \
--output textAssess by layer
Work from the top of your stack down. Each layer can block the move.
| Layer | Usually portable? | What to check |
|---|---|---|
| Java, .NET, Node.js, Python, Ruby, PHP code | Yes | Use a runtime version that has an Arm64 build |
| Go and Rust | Yes, after recompiling | Set the target architecture when you build |
| C and C++ | Yes, after recompiling | Inline assembly and x86-only intrinsics (SSE, AVX) |
| Native extensions and packages | Varies | A published arm64 wheel, binary or package |
| Container base images | Varies | An arm64 variant in the image manifest |
| Third-party agents and vendor software | Varies | Vendor support for Arm64 |
Runtimes and interpreted code
Pure Java, Python or Node.js code has no architecture-specific parts. The runtime itself must have an Arm64 build. Current versions of all the major runtimes do. Old versions may not, so upgrade the runtime before you migrate.
Native dependencies
This is the most common source of trouble. Python packages with C extensions, Node.js modules with native add-ons, and Java libraries that bundle JNI (Java Native Interface) code each need an Arm64 build. If no prebuilt build exists, the package manager tries to compile from source. That needs a compiler toolchain on the host and can be slow or fail.
To find these dependencies, run the install step on an Arm64 machine and read the output. A package that downloads a prebuilt aarch64 file is fine. A package that starts compiling tells you that no prebuilt file exists.
Compiled code
For Go, the build target is an environment variable. Rust uses a target triple.
GOOS=linux GOARCH=arm64 go build -o my-app-arm64 ./...
rustup target add aarch64-unknown-linux-gnu
cargo build --release --target aarch64-unknown-linux-gnuFor C and C++, search the source for asm, __asm__, and headers such as immintrin.h. These point to x86-specific code that needs an Arm alternative or a portable fallback.
Container images
A container image tag can point to several architecture variants. Check that every base image in your Dockerfiles publishes an arm64 variant.
docker buildx imagetools inspect public.ecr.aws/docker/library/python:3.12-slimLook for linux/arm64 in the platform list. If it is missing, choose a different base image. Chapter "Building multi-architecture container images" covers how to publish your own.
Test on real Arm64 hardware
Reading the list above finds known problems. A real test finds the rest. Launch one Graviton instance from an Arm64 image. Use the public SSM parameter to get the current Amazon Linux 2023 AMI ID.
aws ssm get-parameter \
--name /aws/service/ami-amazon-linux-latest/al2023-ami-kernel-default-arm64 \
--query 'Parameter.Value' \
--output textUsing an x86-64 AMI with a Graviton instance type fails at launch, so always use an arm64 AMI.
On that instance, install your dependencies, build the application, and run its unit and integration tests. Treat any failure as a dependency or build problem to fix, not as a reason to skip the test.
Common errors
exec format error: You ran an x86-64 binary or image on Arm64. Rebuild for arm64 or pull the correct image variant.- Package compiles from source and fails: No prebuilt arm64 build exists. Upgrade the package to a version that has one, or install the compiler toolchain.
- Hard-coded architecture in scripts: Download URLs or Dockerfile lines that say
amd64orx86_64break on Arm64. Use variables such asuname -mor theTARGETARCHbuild argument.
Exercise
Your Python service uses a package with a C extension. When you run pip install on a Graviton instance, the output shows the package compiling from source and failing. What does this tell you, and what are two ways to proceed?
Show answer
It tells you that the package has no prebuilt arm64 wheel for your Python and package version. You can upgrade to a package version that publishes an arm64 wheel, or install the compiler toolchain and required development libraries so the build from source succeeds. If neither works, keep that workload on x86 or replace the dependency.