       limit    : 1
       sort     : createdAt : -1
 
+
     JMachine.one selector, options, (err, machine)->
 
       return callback err  if err?

    callback null, "Koding is the best #{ client.r.account.profile.nickname }!"


  calculateNextLabel = (user, group, label, callback)->

    return callback null, label  if label?

        callback null, "koding-vm-#{index+1}"



  @create = (client, options, callback)->

    { instanceType, label, storage } = options
    { r: { group, user, account } } = client

    storage ?= 3
    userPlan = getUserPlan account

    @fetchUsage client, options, (err, usage)->

      return callback err  if err?

      if err = checkUsage usage, userPlan, storage
        return callback err

      calculateNextLabel user, group, label, (err, label)->

        meta =
          type          : "amazon"
          region        : "us-east-1"
          source_ami    : "ami-2651904e"
          instance_type : "t2.micro"
          storage_size  : storage
          alwaysOn      : no

        callback null, {
          meta, label, credential: client.r.user.username
        }


  @fetchUsage = (client, options, callback)->
