--- wikisrc/amazon_ec2.mdwn 2011/02/15 03:26:36 1.5 +++ wikisrc/amazon_ec2.mdwn 2011/02/17 21:01:08 1.6 @@ -69,17 +69,55 @@ AKI, or *Amazon Kernel Image*, are a spe (For the future) Once NetBSD has decent support for Amazon EC2, we will publish the AMI identifiers so you can quickly boot up in a NetBSD environment without going through all the steps given below. -## Fetch and build the operating system +## Fetch and build NetBSD -## Customizations +EC2 does not provide direct access to console. As a consequence, we cannot rely on it for installation, especially via [[!template id=man name=sysinst section=8]]. We must therefore build and install NetBSD in a separate directory, and configure it manually, before upload. -### For EC2 +This tutorial assumes that you will build the system under **/mnt/ec2**. -### For your own needs +/!\Please note that you will need the [[!template id=man name=makefs section=8]] tool later in the process, so you can build a file system image that can be uploaded to Amazon EC2. You are therefore advised to perform the installation directly under a living NetBSD system, or in case your are not, to [[fetch the source|fetching_src]] to build the toolchain that will contain the **nbmakefs** utility. +XXX build and install /mnt/ec2 + +## Configuration + +/!\This part assumes that you have a non-configured NetBSD system extracted under **/mnt/ec2**; that is, it should have not been modified through [[!template id=man name=sysinst section=8]], nor by you. + +Under **/mnt/ec2**, edit the files to add (or modify) these lines: + +[[!template id=filecontent name=etc/rc.conf text=""" +rc_configured=YES + +hostname=NetBSD-EC2-$(uname -m) +sshd=YES # for remote shell access to instance +"""]] + +[[!template id=filecontent name=etc/ssh/sshd_config text=""" +# Allows root to login via authentication keys +PermitRootLogin without-password +"""]] + +Create **etc/fstab** and etc/ifconfig.xennet0**: + +[[!template id=filecontent name=etc/fstab text=""" +/dev/xbd1a / ffs rw 1 1 +/dev/xbd0a /grub ext2 rw 2 2 +kernfs /kern kernfs rw +ptyfs /dev/pts ptyfs rw +procfs /proc procfs rw +"""]] + +[[!template id=filecontent name=etc/ifconfig.xennet0 text=""" +# Configure interface for EC2 network +dhcp +"""]] + +Once done, you can modify the system living under **/mnt/ec2** to fit your needs (adding custom binaries, packages, etc). ## Upload your OS +When the NetBSD is properly installed and configured, we have to upload it to EC2. For that, we will have to create a minimalist EC2 instance, to which we will upload our files to construct our snapshots. + ### Create an Amazon Linux AMI instance ### Upload your files @@ -88,7 +126,7 @@ AKI, or *Amazon Kernel Image*, are a spe ### Shutdown the instance -## Create your customized AMI +## Create your first NetBSD AMI # Play with your first NetBSD instance