Sub topic 3
Building Multi-Architecture Container Images
Assume you know Docker, Amazon ECR, Lambda, Fargate, and basic CloudWatch metrics. A multi-architecture image contains variants for more than one CPU architecture, such as linux/amd64 for x86-64 and linux/arm64 for Graviton. A registry manifest points each host to the correct variant.
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t 111122223333.dkr.ecr.us-east-1.amazonaws.com/my-app:1.0.0 \
--push .The image must use a compatible base image and dependencies for both architectures. Check native libraries, compiled extensions, language runtimes, and third-party binaries. You can inspect the architecture of a running host with:
uname -m
# x86_64 on Intel/AMD instances, aarch64 on Graviton instancesWhere Graviton Fits
Lambda supports Arm64 functions, Fargate supports Arm64 task configurations, and several managed databases offer Graviton-based instance classes. The service controls much of the operating system, but your function code, container image, database engine version, and extensions still need compatibility checks.
| Workload | Main compatibility concern |
|---|---|
| Lambda | Runtime, layers, and native extensions |
| Fargate | Container image and compiled dependencies |
| Managed database | Engine version, features, and client drivers |
Benchmark Before Switching
Compare x86 and Arm64 with the same application version, data shape, concurrency, and limits. Measure throughput, latency percentiles, error rate, CPU, memory, network, and cost per request. A lower hourly price is useful only if performance remains acceptable.
Run representative load tests long enough to capture startup behavior and steady state. Include background jobs and peak traffic. Keep a baseline so a price-performance improvement does not hide a latency regression.
Roll Out and Roll Back
Use a staged rollout: test, canary, small production percentage, then full production. Route traffic by deployment group or weighted alias. Monitor errors, latency, saturation, and business metrics after each step.
Commit After Right-Sizing
Right-size first, then choose Savings Plans. Commitments can reduce cost, but they can also preserve an oversized or unsuitable design. Confirm the target family, size, region, and steady usage before purchasing. During migration, leave enough flexibility for the rollback period.
Exercise
Why should a multi-architecture image use the same application tag for both platforms?
Show answer
The registry can select the correct architecture-specific image automatically when a host pulls that tag.