Open vaibhavsagar opened 5 years ago
it seems like this script uses ec2-bundle-image which needs a connection to amazon and an actual working account. So this seems not to be possible from inside a builder. I can expose the amazonImage though, which is currently a qcow2 image.
If you know a way to generate an ami image offline, I could implement it!
Why does the image have to be build offline?
Maybe using packer would work?
the nix-sandbox doesn't allow internet connections (also this wouldn't be very reproducible then).
packer needs, according to the documentation, aws_access_key and aws_secret_key. So it seems it would need to connect to some AWS servers to create the AMI
Building the image offline is vastly preferable to using Packer, which does connect to an EC2 instance to create an AMI. This can be quite slow and requires an internet connection and AWS credentials.
https://github.com/localstack/localstack < maybe this helps, to build AMIs local.
A better route would be to generate an image that can be consumed by the import-snapshot API: https://docs.aws.amazon.com/vm-import/latest/userguide/vmimport-import-snapshot.html
If the importer is dump and doesn't do anything fancy with the disk image it should work.
It looks like there's already support for this at https://github.com/NixOS/nixpkgs/blob/master/nixos/maintainers/scripts/ec2/create-amis.sh, and it would be nice to expose this as a target.