airbnb/stemcell — pull request #48 by garo (2014-01-23 10:59:04+00:00)
Title: 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. As far as I've concluded this won't affect user experience:

The code path on launching is currently:
first MetadataLauncher::initialize is called. This function calls the following in order: validate_options, then describe_instance and then invoke_launcher. In here the validate_options() checks that all required options are present. If they are then describe_instance() is called, which asks for user confirmation.

After user confirmation invoke_launcher() is called. This calls Launcher::launch and this is where I refactored the verify_required_options() away. This should be completely fine because the options are verified way before in the validate_options() inside metadata_launcher.

This commit contains validation fixes suggested in this github discussion
https://github.com/airbnb/stemcell/pull/46