; How to create AWS EC2 AMI for c5 instance ; On NetBSD/amd64 8.99.28 $ dd if=/dev/zero of=./netbsd-c5-gpt-bios-boot.img bs=1g count=3 # vndconfig vnd0 netbsd-c5-gpt-bios-boot.img # gpt create vnd0 # sudo gpt add -s 2g -t ffs -l AWSROOT vnd0 # gpt add -t swap -l AWSSWAP vnd0 # gpt biosboot -A -i 1 vnd0 # newfs -O2 /dev/rdk5 # installboot -v /dev/rdk5 /usr/mdec/bootxx_ffsv2 # mount /dev/dk5 /mnt # cd /usr/src # ./build.sh -U -O /usr/world/8.99/amd64/obj -T /usr/world/8.99/amd64/tools -D /usr/world/8.99/amd64/destdir -R /usr/world/8.99/amd64/release -u -j 8 -m amd64 tools # ./build.sh -U -O /usr/world/8.99/amd64/obj -T /usr/world/8.99/amd64/tools -D /usr/world/8.99/amd64/destdir -R /usr/world/8.99/amd64/release -u -j 8 -m amd64 kernel=DTRACE7 # ./build.sh -U -O /usr/world/8.99/amd64/obj -T /usr/world/8.99/amd64/tools -D /usr/world/8.99/amd64/destdir -R /usr/world/8.99/amd64/release -u -j 8 -m amd64 distribution # ./build.sh -U -O /usr/world/8.99/amd64/obj -T /usr/world/8.99/amd64/tools -D /usr/world/8.99/amd64/destdir -R /usr/world/8.99/amd64/release -u -j 8 -m amd64 -V INSTALLSETS=base comp etc games man misc modules tests text install=/mnt # cp /usr/mdec/boot /mnt # cp /usr/world/8.99/amd64/obj/sys/arch/amd64/compile/DTRACE7/netbsd /mnt # vi /mnt/etc/rc.d/ec2_init (See: https://wiki.netbsd.org/amazon_ec2/build_your_own_ami/) # chmod 555 /mnt/etc/rc.d/ec2_init # vi /mnt/etc/rc.conf rc_configured=YES ec2_init=YES sshd=YES # for remote shell access to instance # vi /mnt/etc/ssh/sshd_config PermitRootLogin without-password # mkdir /mnt/proc /mnt/kern # vi /mnt/etc/ifconfig.ena0 dhcp # vi /mnt/etc/fstab NAME=AWSROOT / ffs rw,log 1 1 NAME=AWSSWAP none swap sw,dp 0 0 kernfs /kern kernfs rw ptyfs /dev/pts ptyfs rw procfs /proc procfs rw tmpfs /var/shm tmpfs rw,-m1777,-sram%25 # cd /mnt/dev # ./MAKEDEV all # cd ~ # umount /mnt # vndconfig -u vnd0 # cd /usr/pkgsrc/net/py-awscli # make install $ aws configure AWS Access Key ID [None]: XXX AWS Secret Access Key [None]: XXX Default region name [None]: us-east-1 Default output format [None]: text $ aws ec2 run-instances --image-id ami-009d6802948d06e52 --instance-type c5.large --key-name c5-20181220 619017845909 r-0dab8fafc6dbc2a6c INSTANCES 0 x86_64 False xen ami-009d6802948d06e52 i-01dfee86f4d0d109d c5.large c5-20181220 2018-12-21T13:41:14.000Z ip-172-31-38-245.ec2.internal 172.31.38.245 /dev/xvda ebs True subnet-73de462f hvm vpc-d459f1ae CPUOPTIONS 1 2 MONITORING disabled NETWORKINTERFACES 0e:de:7c:89:d3:a2 eni-0a38d352461629255 619017845909 ip-172-31-38-245.ec2.internal 172.31.38.245 True in-use subnet-73de462f vpc-d459f1ae ATTACHMENT 2018-12-21T13:41:14.000Z eni-attach-09acc70fb71f4bd95 True 0 attaching GROUPS sg-1d45925e default PRIVATEIPADDRESSES True ip-172-31-38-245.ec2.internal 172.31.38.245 PLACEMENT us-east-1d default SECURITYGROUPS sg-1d45925e default STATE 0 pending STATEREASON pending pending $ aws ec2 describe-instances --instance-ids i-01dfee86f4d0d109d ESERVATIONS 619017845909 r-0dab8fafc6dbc2a6c INSTANCES 0 x86_64 False True xen ami-009d6802948d06e52 i-01dfee86f4d0d109d c5.large c5-20181220 2018-12-21T13:41:14.000Z ip-172-31-38-245.ec2.internal 172.31.38.245 ec2-34-229-210-170.compute-1.amazonaws.com 34.229.210.170 /dev/xvda ebs True subnet-73de462f hvm vpc-d459f1ae BLOCKDEVICEMAPPINGS /dev/xvda EBS 2018-12-21T13:41:15.000Z True attached vol-029d14d5198ee2174 CPUOPTIONS 1 2 HIBERNATIONOPTIONS False MONITORING disabled NETWORKINTERFACES 0e:de:7c:89:d3:a2 eni-0a38d352461629255 619017845909 ip-172-31-38-245.ec2.internal 172.31.38.245 True in-use subnet-73de462f vpc-d459f1ae ASSOCIATION amazon ec2-34-229-210-170.compute-1.amazonaws.com 34.229.210.170 ATTACHMENT 2018-12-21T13:41:14.000Z eni-attach-09acc70fb71f4bd95 True 0 attached GROUPS sg-1d45925e default PRIVATEIPADDRESSES True ip-172-31-38-245.ec2.internal 172.31.38.245 ASSOCIATION amazon ec2-34-229-210-170.compute-1.amazonaws.com 34.229.210.170 PLACEMENT us-east-1d default SECURITYGROUPS sg-1d45925e default STATE 16 running $ aws ec2 create-volume --availability-zone us-east-1d --volume-type standard --size 3 $ aws ec2 describe-volumes --volume-ids vol-076f8c399f56e6753 VOLUMES us-east-1d 2018-12-21T13:44:05.665Z False 3 available vol-076f8c399f56e6753 standard $ aws ec2 attach-volume --instance-id i-01dfee86f4d0d109d --volume-id vol-076f8c399f56e6753 --device "/dev/sdf" 2018-12-21T13:46:15.709Z /dev/sdf i-01dfee86f4d0d109d attaching vol-076f8c399f56e6753 $ aws ec2 describe-volumes --volume-ids vol-076f8c399f56e6753 VOLUMES us-east-1d 2018-12-21T13:44:05.665Z False 3 in-use vol-076f8c399f56e6753 standard ATTACHMENTS 2018-12-21T13:46:15.000Z False /dev/sdf i-01dfee86f4d0d109d attached vol-076f8c399f56e6753 $ aws ec2 authorize-security-group-egress --group-id sg-1d45925e --port 22 --protocol all $ aws ec2 authorize-security-group-egress --group-id sg-1d45925e --port 22 --protocol all --cidr 0.0.0.0/0 $ scp -i c5-20181220.pem netbsd-c5-gpt-bios-boot.img.gz ec2-user@ec2-34-229-210-170.compute-1.amazonaws.com:~/ $ ssh -i c5-20181220.pem ec2-user@ec2-34-229-210-170.compute-1.amazonaws.com [ec2-user@ip-172-31-38-245 ~]$ gunzip netbsd-c5-gpt-bios-boot.img.gz [ec2-user@ip-172-31-38-245 ~]$ sudo dd if=netbsd-c5-gpt-bios-boot.img of=/dev/sdf bs=64k $ aws ec2 detach-volume --volume-id vol-076f8c399f56e6753 2018-12-21T13:46:15.000Z /dev/sdf i-01dfee86f4d0d109d detaching vol-076f8c399f56e6753 $ aws ec2 create-snapshot --volume-id vol-076f8c399f56e6753 False 619017845909 snap-04eb837b14f764a00 2018-12-21T14:06:20.000Z pending vol-076f8c399f56e6753 3 $ aws ec2 terminate-instances --instance-ids i-01dfee86f4d0d109d TERMINATINGINSTANCES i-01dfee86f4d0d109d CURRENTSTATE 32 shutting-down PREVIOUSSTATE 16 running $ aws ec2 register-image --architecture x86_64 --name "NetBSD/amd64 8.99.28 with ena" --ena-support --virtualization-type hvm --block-device-mappings 'DeviceName=/dev/sda1,Ebs={SnapshotId=snap-04eb837b14f764a00}' --root-device-name "/dev/sda1" ami-088a6d6fc2dccd87b ; Launch a instance with this ami.