Repository navigation
feat(build): Support X86_64 MicrovmImages - #9415
Conversation
The MicroVM service now builds X86_64 images, but sam build treated CpuConfigurations Architecture X86_64 as unsupported: it skipped the image when building all resources and failed a targeted build. Accept X86_64 and build it for linux/amd64. An image without CpuConfigurations is still built for arm64, which is what the service builds for an empty list.
🧪 Hands-on test: No problems observed in 6 scenariosCommit Scenarios
Runner's notes in full
🤖 Automated hands-on test — not a review approval · model claude-opus-5.5 · Kiro kiro-cli 2.33.1 · build History (3)
|
There was a problem hiding this comment.
🧪 Hands-on test reproduced 1 new problem on commit 9d2915d. Commands and evidence are in the hands-on comment.
- [BUG] Mixed-arch build-all: DefaultImage (arm64) is built from the amd64 base image pulled for the X86_64 image, while the summary says linux/arm64 · medium · samcli/lib/build/app_builder.py:1248
🤖 Automated hands-on test — not a review approval
Check that CpuConfigurations Architecture X86_64 is extracted as x86_64, and that such an image is returned as buildable.
There was a problem hiding this comment.
🧪 Hands-on test reproduced 3 new problems on commit 462ba9e. Commands and evidence are in the hands-on comment.
- [BUG] X86_64 MicrovmImage build fails with 'exec format error' when an arm64 copy of its base image is cached locally (e.g. after an ARM_64 build) · medium
- [BUG] In a mixed-architecture build, DefaultImage is reported as linux/arm64 in the summary and JSON but is built as linux/amd64 · medium
- [BUG] Changing CpuConfigurations from ARM_64 to X86_64 reports (linux/amd64) but the rebuilt image stays linux/arm64 (Docker layer cache reused) · medium
🤖 Automated hands-on test — not a review approval
Build an X86_64 MicrovmImage and check that the image is linux/amd64. The fixture uses a base image that no arm64 test uses, so the classic builder cannot reuse a base image cached for another platform.
|
Response to the hands-on findings on Root cause. With the classic (non-BuildKit) builder and the classic image store, Docker reuses a base image tag that is already cached locally, even when it was pulled for another platform, instead of resolving it for the requested Where it reproduces. Same templates built against Docker-in-Docker daemons with the classic
It does not reproduce with the containerd image store (the Docker Desktop default), which keeps every platform of a tag. So Plan. |
Which issue(s) does this change fix?
Follow-up to #9357, which added
sam buildsupport for MicrovmImage.Why is this change necessary?
The MicroVM service now builds X86_64 images: the
AWS::Lambda::MicrovmImageCpuConfigurations[].ArchitectureacceptsARM_64andX86_64, and the managed base imageal2023-1version 3 supports both.sam buildstill treatedArchitecture: X86_64as unsupported. Building all resources skipped the image, andsam build <image>failed with "unsupported architecture; only ARM_64 is supported by the MicroVM service".How does it address the issue?
SamMicrovmImageProvidermapsX86_64tox86_64, so the image is built forlinux/amd64. The cross-architecture warning, the build summary and the JSON output already handle any architecture.CpuConfigurationsis still built forarm64. I deployed one with base image version 3 and noCpuConfigurations: the SAM transform wroteCpuConfigurations: [], and the service built the image withcpuConfigurations: [{architecture: ARM_64}].ARM_64andX86_64.What side effects does this change have?
None for
ARM_64or an omitted architecture.sam validateand deployments still rejectX86_64onAWS::Serverless::MicrovmImageuntil the SAM transform allows it (aws/serverless-application-model#4031) and SAM CLI moves to that aws-sam-translator release.AWS::Lambda::MicrovmImageis not affected by the transform.Testing
X86_64image and an image withoutCpuConfigurationson an arm64 host with Docker. The images werelinux/amd64andlinux/arm64, and aRUN uname -mstep reportedx86_64andaarch64. The build printed the cross-architecture warning for theX86_64image, and--output jsonreportedx86_64andarm64.test_build_x86_64_microvm_image, builds anX86_64image and checks that it islinux/amd64, with and without--use-buildkit. It runs with the other MicrovmImage tests in thebuild-arm64integration suite.RISCVis still skipped when building all resources and fails a targeted build.X86_64is extracted asx86_64, and the image is now in the buildable images list. Removing theX86_64mapping fails it. Unit tests pass (9770, coverage 94.08%).Mandatory Checklist
PRs will only be reviewed after checklist is complete
make prpassesmake update-reproducible-reqsif dependencies were changedBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.