    # File lib/fog/aws/models/compute/spot_request.rb, line 86
            def save
              requires :image_id, :flavor_id, :price

              options = {
                'AvailabilityZoneGroup'                          => availability_zone_group,
                'InstanceCount'                                  => instance_count,
                'LaunchGroup'                                    => launch_group,
                'LaunchSpecification.BlockDeviceMapping'         => block_device_mapping,
                'LaunchSpecification.KeyName'                    => key_name,
                'LaunchSpecification.Monitoring.Enabled'         => monitoring,
                'LaunchSpecification.Placement.AvailabilityZone' => availability_zone,
                'LaunchSpecification.SecurityGroup'              => groups,
                'LaunchSpecification.UserData'                   => user_data,
                'LaunchSpecification.SubnetId'                   => subnet_id,
                'LaunchSpecification.IamInstanceProfile.Arn'     => @iam_instance_profile_arn,
                'LaunchSpecification.IamInstanceProfile.Name'    => @iam_instance_profile_name,
                'Type'                                           => request_type,
                'ValidFrom'                                      => valid_from,
                'ValidUntil'                                     => valid_until }
              options.delete_if {|key, value| value.nil?}

              # If subnet is defined then this is a Virtual Private Cloud.
              # subnet & security group cannot co-exist. Attempting to specify
              # both subnet and groups will cause an error.  Instead please make
              # use of Security Group Ids when working in a VPC.
              if subnet_id
                options.delete('LaunchSpecification.SecurityGroup')
              else
                options.delete('LaunchSpecification.SubnetId')
              end

              data = service.request_spot_instances(image_id, flavor_id, price, options).body
              spot_instance_request = data['spotInstanceRequestSet'].first
              spot_instance_request['launchSpecification'].each do |name,value|
                spot_instance_request['LaunchSpecification.' + name[0,1].upcase + name[1..-1]] = value
              end
              spot_instance_request.merge(:groups => spot_instance_request['LaunchSpecification.GroupSet'])
              spot_instance_request.merge(options)
              merge_attributes( spot_instance_request )
            end