Creating a NetBSD AMI with bsdec2-image-upload
About bsdec2-image-upload
The bsdec2-image-upload tool automates creation of AMIs based on raw disk images. This tool is available in pkgsrc as sysutils/bsdec2-image-upload.
Getting a disk image
The following images are configured to automatically detect an EC2 environment and resize the root disk at boot. Creating a custom image is not covered in this document.
x86
- NetBSD -current: http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/images/NetBSD-9.99.72-amd64-live.img.gz
- NetBSD 9.x: not supported
Arm
- NetBSD -current: http://nycdn.netbsd.org/pub/NetBSD-daily/HEAD/latest/evbarm-aarch64/binary/gzimg/arm64.img.gz
- NetBSD 10.0 (official release): https://ftp.netbsd.org/pub/NetBSD/NetBSD-10.0/evbarm-aarch64/binary/gzimg/arm64.img.gz
- NetBSD 10.x (latest): http://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-10/latest/evbarm-aarch64/binary/gzimg/arm64.img.gz
- NetBSD 9.x (latest): http://nycdn.netbsd.org/pub/NetBSD-daily/netbsd-9/latest/evbarm-aarch64/binary/gzimg/arm64.img.gz
Prerequisites
Install bsdec2-image-upload
Install sysutils/bsdec2-image-upload from pkgsrc.
Setup AWS credentials
In the IAM Management Console, create an access key. Enter these into in a file named keyfile.txt:
Create S3 bucket for image upload
An S3 bucket is required for temporary storage during the upload and conversion process. This can be created on the S3 Management Console.
Creating an AMI
Cleanup
Once the images are uploaded, some artifacts will be left in the S3 bucket. These can be safely deleted.
Starting an instance
On the EC2 Management Console, select the region matching the AMI you just uploaded. Then under the AMIs section on the left, select your newly created AMI and click the Launch button to create a new instance.
The credentials specified during creation of the instance can be used to login with ssh as the root user (NetBSD 9) or ec2-user (NetBSD -current) after NetBSD has booted: