GEC2: Gentoo EC2, Puppet and Portage Tools Copyright 2008 Tim Dysinger http://www.opensource.org/licenses/mit-license.php This project is a hybrid EC2, Puppet & Portage management tool for Gentoo Linux images. With it you can build a Gentoo EC2 image from scratch, bundle it, upload it to Amazon and fire it up. All software management from the image stage to the running instance (ongoing) is managed by Puppet. Additionally there is a portage overlay for packages helpful to running servers at ec2. Even if you just want to use gentoo and don't want to bother with puppet, this project can be of use to you. The base images are nothing more than gentoo base system, dhcp, ddclient, openntp, syslog, vixie-cron, postfix, java, ruby & rubygems, puppet and amazon api/ami tools. This is pretty small and (besides puppet) is the base minimum to run an ec2 instance & exercise the api/ami tools. If you don't feel like messing around with creating images for ec2 from scratch (or just want to mess around with a good solid ec2 optimized gentoo image), then just use one of the following public images I created (they were created using this same process and are the end product): ami-d22cc8bb m1.small 32-bit 1-core "athlon-xp" optimized ami-c02cc8a9 m1.large 64-bit 2-core "opteron" optimized ami-c12cc8a8 m1.xlarge 64-bit 4-core "opteron" optimized ami-5d2dc934 c1.medium 32-bit 2-core "prescott" optimized ami-332cc85a c1.xlarge 64-bit 8-core "nocona" optimized ========================================================================= If you would like to dig in or customize your image follow the following: ========================================================================= Now that we have some dog food to eat, you can just fire up one of the gentoo public images above. Use the proper image that matches the instance type you are targeting. Rsync this project to your build server and login $ rsync -r -u root@myec2buildserver:~/gec2 $ ssh myec2buildserver $ cd gec2 Update ruby & gems on your build server. $ gem update $ gem install rake amazon-ec2 aws-s3 hpricot facter --no-rdoc --no-ri $ gem clean Look in the example dir and copy env.yml to the base dir with your correct aws account attributes. Then run rake to assemble the base gentoo image. $ rake -t image:configure ;# or nohup it so you can logout if you want This may take a couple hours as 100% of the OS is compiled for the CPU and Architecture of the image type. If all goes well you'll have a fully created chroot gentoo image. I say "If all goes well" becase gentoo is very hands on as things change in the portage tree. You then need to bundle it for ec2, upload and register it. $ rake -t image:upload If all goes well you should have a nice fresh image for yourself in a bucket all registered and ready to launch. I say "If all goes well" because sometimes the upload process to s3 fails. Just try it again. Now start a puppet master server $ rake -t run[us-east-1c,c1.medium,ami-XXXXYYY,lolcatz,lolcatz] Now setup your cluster module and users and your node declarations like the example. Then sync up your puppet master manifests & modules $ ssh-add ~/.ssh/lolcatz.pem $ rsync -r -u root@my.amazon.lolcatz.master.server.com:/etc/puppet Start some puppets (node names must match your nodes on the nodes.pp manifest) $ rake -t instance:run[us-east-1c,c1.medium,ami-XXXXYYY,lolcatz,curious] $ rake -t instance:run[us-east-1c,c1.medium,ami-XXXXYYY,lolcatz,puffball] HINT: As you are working with puppet. Log into the master server and run puppet and puppet master in debug mode. $ puppetmaster --no-daemonize -v -d ; # on puppetmaster $ puppet $PUPPET_EXTRA_OPTS --test -d ; # on puppets