Module Name: othersrc Committed By: riz Date: Fri Apr 20 21:01:03 UTC 2012
Added Files: othersrc/share/examples/ec2: README TODO build_ec2_img.sh create-new.sh create_ec2_ami.sh set_ec2_env.sh othersrc/share/examples/ec2/files: bootstrap.sh ec2_bootmail ec2_firstboot ec2_init motd spec.in Log Message: Example scripts and supporting files for creating Amazon EC2 AMIs (Amazon Machine Images) running NetBSD. Requires an Amazon EC2 account. Please test and extend these scripts! The original scripts were written by Jean-Yves Migeon, heavily modified >From the README: Notes on using these scripts for creating EC2 AMIs -------------------------------------------------- Here are some assumptions made: - You have the EC2 API tools already set up. If you don't already, the easiest way to do so is to install the misc/ec2-api-tools package from pkgsrc. An easy way to check if they're set up properly is if you can run "ec2-describe-instances" without an error. - You are running this from a NetBSD system. It's certainly not impossible to update this for running on another platform, but it'll be necessary to adapt to using a NetBSD tools build for (at least) makefs. - Your default EC2 profile allows ssh to your running instances from the location you're running this script! - The most-used (and tested!) script (create_ec2_ami.sh) assumes that there are NetBSD 6.0 AMIs available on EC2 already, for bootstrapping. The public images in account 101367081206 (an account owned by me, Jeff Rizzo, a NetBSD developer) are available for use, and are searched in addition to the user's own AMIs. You can also specify a particular AMI to use for the bootstrapping. There is another script (create-new.sh) which is less well tested, and which may currently be broken, which allows you to use a Linux AMI to create a NetBSD one. You will need to create a 'bootstrap' image with an ext2 file system (see build_ec2_img.sh, specifically the "-b" flag). CREATING AN AMAZON MACHINE IMAGE (AMI) -------------------------------------- Once you've verified the Amazon EC2 command-line tools work (see above), the basic workflow is as follows: - Edit the set_ec2_env.sh script to have the location of your certs/keys. This file is read by several of the scripts. - Either build sets with build.sh, or identify where the release you want to base your AMI on lives. You can access built sets via http, ftp, or on the local fs. - Build an image for upload, using the build_ec2_img.sh script. This image will contain everything *except* the kernel (the kernel will be on a separate ext2fs partition, due to EC2 boot requirements), and will be resized to fit the volume created in the AMI creation script. An example of doing this: ./build_ec2_img.sh -d http://ftp.netbsd.org/pub/NetBSD/NetBSD-6.0_BETA/amd64/binary/sets ...this will create an image file in the current directory. - Create the AMI from the above image plus a kernel. You have to specify which region to create the AMI in: ./create_ec2_ami.sh -i ./NetBSD-AMI.img.xz -a x86_64 -d "AMI description goes here" -k http://ftp.netbsd.org/pub/NetBSD/NetBSD-6.0_BETA/amd64/binary/kernel/netbsd-XEN3_DOMU.gz -v "6.0_BETA-or-whatever-version-string-you-want" us-east-1 The process can take anywhere from 10-60 minutes, depending on which region you choose and how fast your connection is for uploading. After a successful run, be sure to test your AMI! To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 othersrc/share/examples/ec2/README \ othersrc/share/examples/ec2/TODO \ othersrc/share/examples/ec2/build_ec2_img.sh \ othersrc/share/examples/ec2/create-new.sh \ othersrc/share/examples/ec2/create_ec2_ami.sh \ othersrc/share/examples/ec2/set_ec2_env.sh cvs rdiff -u -r0 -r1.1 othersrc/share/examples/ec2/files/bootstrap.sh \ othersrc/share/examples/ec2/files/ec2_bootmail \ othersrc/share/examples/ec2/files/ec2_firstboot \ othersrc/share/examples/ec2/files/ec2_init \ othersrc/share/examples/ec2/files/motd \ othersrc/share/examples/ec2/files/spec.in Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.