How do I terminate an instance using the Cloud API?

You can terminate an instance from the command line using the Cloud API:

  1. Generate an API key if you haven’t already generated one.

  2. Create a file that contains the necessary payload. For example:

    {
      "instance_ids": [
        "0920582c7ff041399e34823a0be62549"
      ]
    }
    
  3. Run the following command:

    curl -u API-KEY: https://cloud.lambdalabs.com/api/v1/instance-operations/terminate -d @INSTANCE-IDS -H "Content-Type: application/json" | jq .
    

    Replace API-KEY with your actual API key. Don’t remove the trailing colon (:).

    Replace INSTANCE-IDS with the name of the payload file you created in the previous step.


Last modified February 11, 2023: Use more popular name (8ae4ab5)