def create_new_key_pair(region, pair_name)
      @logger.debug("aws-sdk: importing new key pair: #{pair_name}")
      client(region).import_key_pair(:key_name => pair_name, :public_key_material => public_key)

      begin
        client(region).wait_until(:key_pair_exists, { :key_names => [pair_name] }, :max_attempts => 5, :delay => 2)
      rescue Aws::Waiters::Errors::WaiterFailed
        raise RuntimeError, "AWS key pair #{pair_name} can not be queried, even after import"
      end
    end
def create_new_key_pair(region, pair_name)
      @logger.debug("aws-sdk: importing new key pair: #{pair_name}")
      client(region).import_key_pair(:key_name => pair_name, :public_key_material => public_key)

      begin
        client(region).wait_until(:key_pair_exists, { :key_names => [pair_name] }, :max_attempts => 5, :delay => 2)
      rescue Aws::Waiters::Errors::WaiterFailed
        raise RuntimeError, "AWS key pair #{pair_name} can not be queried, even after import"
      end
    end
Create a new key pair for a given Beaker run

 @param [Aws::EC2::Region] region the region the key pair will be imported into
 @param [String] pair_name the name of the key to be created

 @return [Aws::EC2::KeyPair] key pair created
 @raise [RuntimeError] raised if AWS keypair not created