In essence, this is this bash script, but in rust.
It also makes the choice of uploading snapshots directly rather than using the "vmimport" service, which makes it simpler to operate (no need for an IAM role + s3 bucket to be setup), and in some cases is also faster.
The actual snapshot uploading is done using coldsnap.
- Create a nixos AMI, as seen here.
Note, the format must be
raw
. - Build the nix derivation in 1, such as with
nix-build -o ami my-custom-ami.nix
The output will have anix-support/image-info.json
file present if done correctly. - Use this tool to upload that ami with
nixos-ami-upload /path/to/nix-build/result --regions us-west-2,us-west-1
.
At the time of writing, this is neither heavily tested, nor all that clean code. Caveat emptor.
Apache 2.0, since it borrows code from coldsnap which is similarly licensed.