Deleting Instances

You can delete instances on an existing cloud by DELETing to /api/clouds/XXXXX/instances/XXXXX
Instances have to be shut down first if you want to delete them. See creating, starting, stopping, and rebooting instances

RestClient.delete(API_aim + "/api/clouds/XXXXX/instances/XXXXX, headers)

If you want to delete the instances EBS volumes and/or ElasticIPs as well, you can send an additional body. This doesn't work in the current RestClient Gem, therefore I used curl for this example.

curl -XDELETE
     -H 'X-Scalarium-Token: XXXXX' -H 'Accept: application/vnd.scalarium-v1+json'
     -d '{"delete_volumes":true, "delete_elastic_ip":true}'
     https://manage.scalarium.com/api/clouds/XXXXX/instances/XXXXX

So the options are

  • delete_volumes: true, will delete all EBS volumes used by this instance
  • delete_elastic_ip: true, will delete the ElasticIP of this instance

If the deletion did not succeed you will get a 412 HTTP status code. Most likely the instance was still running.