-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Open Source AWSTOE #102
Comments
FWIW I would suggest just using https://github.com/nixos/amis with a custom NixOS config. Booting up a NixOS image with user data and then snapshotting sounds very wasteful when you can just build and upload snapshot directly using a You can do:
Indeed you can't use |
Oh nice, didn't realise I agree booting up a NixOS instance in EC2 for this is wasteful, but the cost is small compared to the significant quality of life benefits CloudFormation brings in CI/CD environments. In particular, CloudFormation will auto-delete the old AMI if a new one needs to replace it during stack update. Image Builder also automates a lot of extra things like AMI metadata + sharing/distribution which we need to figure out how to do with direct API calls otherwise. When combined with an
Doing local NixOS VM image builds with To be clear, I don't think the official NixOS AMI build pipeline should swap over to EC2 Image Builder. We still need a starting AMI for Image Builder to work so some bootstrap NixOS AMI is needed. With today's NixOS AMI setup, that would be from local build or Hydra. Long term that might be from installing Nix on, for example, the latest Amazon Linux and building on an EC2 instance. Rather, it might make sense for the base NixOS AMIs to package AWSTOE out-of-the-box (once it's open sourced and packaged in Nixpkgs) so people can use those in Image Builder. For context, I'm looking at setting up an auto-scaling GitLab Runner fleet in EC2 that's deployed with GitLab Pipelines. This runner fleet needs to support x86-64 + AArch64 Linux (NixOS or bring-your-own-userspace with OCI containers), AArch64 macOS, and x86-64 + AArch64 Windows. Most people at my company use Apple Silicon MacBooks (so Essentially, we have to assume that:
Even if we could easily generate all the NixOS VM images locally, we still need to handle macOS and Windows. It's much easier to unify everything in Image Builder (can handle Linux and Windows today. I imagine macOS is planned) than having a Nix-specific AMI build process and Image Builder for the rest. |
Feel free to bounce off ideas with me in #aws:nixos.org on Matrix. We're running a setup with pretty similar requirements. Just GitHub Actions instead of GitLab |
Spoke with a Principal Engineer for Image Builder. Currently not on the roadmap and, with Image Builder having support for workflows which only use the SSM Agent unlike component-based recipes which use both SSM Agent and AWSTOE, this isn't as necessary for NixOS image build pipelines. |
Feature Request
Open source AWSTOE.
This can let 3rd parties help add support for additional operating systems (e.g. macOS, NixOS, Alpine Linux) either through code contributions or package distribution (e.g. packaging ecosystems that prefer building from source over pre-compiled binaries). For AWS, this can quickly expand the list of supported operating systems.
This will also bring AWSTOE in line with other open sourced AWS agents, including:
Additional Context
EC2 Image Builder currently provides the only avenue for users to manage EC2 AMIs and AMI lifecycle policies purely through AWS-provided CloudFormation resources (e.g.
AWS::ImageBuilder::Image
,AWS::ImageBuilder::LifecyclePolicy
).In comparison, other AMI baking solutions such as S3 → VM image import or HashiCorp Packer require a lot of extra supporting infrastructure to properly track and clean up old AMIs.
macOS in particular can't even use the S3 → VM image import path since neither the original EC2
ImportImage
API nor the EC2 Image BuilderImportVmImage
API support macOS VM images.These APIs also might not even support AArch64 (a.k.a. ARM64) VM images since the docs imply that
ImportVmImage
is really just a convenience wrapper aroundImportImage
which doesn't support importing ARM64 VM images.This makes Image Builder particularly attractive because it supports i386, x86-64, and AArch64.
Unfortunately, Image Builder seems to require AWSTOE to work. This is because
CreateImageRecipe
requires at least 1 image builder component (CreateImageRecipeRequest.components
) to be specified.As a result, users can't just work around this by only specifying
CreateImageRecipeRequest.additionalInstanceConfiguration.userDataOverride
to set up the instance and then have Image Builder create AMIs without AWSTOE (just needs to snapshot the instance after the user data script completes).In particular, I was looking to create a NixOS AMI by only specifying a user data script and have Image Builder snapshot the resulting instance.
To put it shortly:
apt
,dnf
,yum
, etc.).Config
file, Brazil VSR, and Apollo VFI.Nix doesn't install packages to filesystem hierarchy standard (FHS) directories like
/usr/bin
which can cause problems for things that hardcode paths like the Amazon CloudWatch Agent'sstart-amazon-cloudwatch-agent
binary. See aws/amazon-cloudwatch-agent#1319 for an explanation of Nix install paths and the CloudWatch Agent issue.(cc: @arianvp NixOS AMI and
amazon-init
NixOS service module maintainer)Community Note
The text was updated successfully, but these errors were encountered: