airbnb/stemcell — pull request #46 by garo (2014-01-21 12:40:45+00:00)
Title: Feature/vpc support

Add support to launch instance into a VPC subnet

Add a rudimentary support for launching instances into VPC. Mainly this means new vpc_subnet_id argument which specifies the "subnet-xxx" id of the Amazon EC2 VPC subnet. As the subnet can live only in one Availability Zone then the availability zone argument is not needed when launching into vpc. Because of this there's a new way to specify an array of arguments where only one argument is required.

This patch also refactored away the Launcher::verify_required_options method as the required options are already checked on the metadata_launcher.

Tell me what you think. One can start using VPC with this, but I'm thinking about writing some code which gets the VPC subnet data (like network CIDR etc) from EC2 and displays it in the confirmation text. I didn't yet do this because it would need a bit more refactoring.

To use you simply define the vpc_subnet_id as followd:
default_attributes({
"instance_metadata" => {
"vpc_subnet_id" => "subnet-8d900000"
}
})