    # File lib/fog/aws/models/compute/spot_requests.rb, line 37
            def bootstrap(new_attributes = {})
              spot_request = connection.spot_requests.new(new_attributes)

              unless new_attributes[:key_name]
                # first or create fog_#{credential} keypair
                name = Fog.respond_to?(:credential) && Fog.credential || :default
                unless spot_request.key_pair = connection.key_pairs.get("fog_#{name}")
                  spot_request.key_pair = connection.key_pairs.create(
                    :name => "fog_#{name}",
                    :public_key => spot_request.public_key
                  )
                end
              end

              # make sure port 22 is open in the first security group
              security_group = connection.security_groups.get(spot_request.groups.first)
              authorized = security_group.ip_permissions.detect do |ip_permission|
                ip_permission['ipRanges'].first && ip_permission['ipRanges'].first['cidrIp'] == '0.0.0.0/0' &&
                ip_permission['fromPort'] == 22 &&
                ip_permission['ipProtocol'] == 'tcp' &&
                ip_permission['toPort'] == 22
              end
              unless authorized
                security_group.authorize_port_range(22..22)
              end

              spot_request.save
              spot_request.wait_for(Fog.timeout, interval=4) { ready? }
              Fog.wait_for { server = connection.servers.get(spot_request.reload.instance_id) }
              server = connection.servers.get(spot_request.instance_id)
              if spot_request.tags
                for key, value in spot_request.tags
                  connection.tags.create(
                    :key          => key,
                    :resource_id  => spot_request.instance_id,
                    :value        => value
                  )
                end
              end
              server.wait_for { ready? }
              server.setup(:key_data => [spot_request.private_key])
              server
            end