lib/rubber/cloud/aws.rb in axtro-rubber-1.2.2 vs lib/rubber/cloud/aws.rb in axtro-rubber-1.2.3

- old
+ new

@@ -14,10 +14,12 @@ @ec2elb = AWS::ELB::Base.new(:access_key_id => @aws_env.access_key, :secret_access_key => @aws_env.secret_access_key) AWS::S3::Base.establish_connection!(:access_key_id => @aws_env.access_key, :secret_access_key => @aws_env.secret_access_key) end def create_instance(ami, ami_type, security_groups, availability_zone, user_data = nil) - response = @ec2.run_instances(:user_data => user_data, :image_id => ami, :key_name => @aws_env.key_name, :instance_type => ami_type, :security_group => security_groups, :availability_zone => availability_zone) + instance_options = {:image_id => ami, :key_name => @aws_env.key_name, :instance_type => ami_type, :security_group => security_groups, :availability_zone => availability_zone} + instance_options[:user_data] = Base64.encode64(user_data) if user_data + response = @ec2.run_instances(instance_options) instance_id = response.instancesSet.item[0].instanceId return instance_id end def create_spot_instance_request(spot_price, ami, ami_type, security_groups, availability_zone)