https://github.com/euank/nixos-ami-upload
Tool to upload NixOS Amazon Machine images
https://github.com/euank/nixos-ami-upload
aws-ec2-ami nixos
Last synced: about 1 month ago
JSON representation
Tool to upload NixOS Amazon Machine images
- Host: GitHub
- URL: https://github.com/euank/nixos-ami-upload
- Owner: euank
- License: apache-2.0
- Created: 2021-07-30T11:48:02.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-04-07T09:26:16.000Z (about 3 years ago)
- Last Synced: 2025-01-24T17:19:55.582Z (over 1 year ago)
- Topics: aws-ec2-ami, nixos
- Language: Rust
- Homepage:
- Size: 29.3 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## nixos-ami-upload
In essence, this is [this bash script](https://github.com/NixOS/nixpkgs/blob/bed52081e58807a23fcb2df38a3f865a2f37834e/nixos/maintainers/scripts/ec2/create-amis.sh), 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](https://github.com/awslabs/coldsnap/).
### Usage
1. Create a nixos AMI, as seen [here](https://github.com/euank/nixek-overlay/blob/87cb836fcfc0c7242a9128790737cb0faeeb72c6/amis/jenkins-worker/default.nix#L1-L42).
Note, the format _must_ be `raw`.
2. Build the nix derivation in 1, such as with `nix-build -o ami my-custom-ami.nix` The output will have a `nix-support/image-info.json` file present if done correctly.
3. Use this tool to upload that ami with `nixos-ami-upload /path/to/nix-build/result --regions us-west-2,us-west-1`.
### Status
At the time of writing, this is neither heavily tested, nor all that clean
code. Caveat emptor.
## License
Apache 2.0, since it borrows code from coldsnap which is similarly licensed.