delete linode
is it possible to make a setting to delete the linode in lets say 5 hours from now? something like crontab in linux.
thank you
5 Replies
It should be possible to automate the deletion using the API:
https://techdocs.akamai.com/linode-api/reference/delete-linode-instance
It should be possible to automate the deletion using the API
However, if this API call emanated from the Linode that was being deleted, the results might be indeterminate. Is there any documentation that says API calls have ACID properties?
Just wondering…
-- sw
First, you'll have to get an Personal API token from Linode. Those are pretty easy to come by. Each API command takes a stream of JSON-formatted text as part of the request and provides a stream of JSON-formatted text as a response.
You can execute the API commands from a shell script using curl as shown in the examples for each command. For shell scripts, you'll probably want to check out jq to be able to query the (JSON-formatted) response text for specific values. There's also a (python-based) command called linode-cli that will allow you to interact with the Linode API either interactively or in shell scripts. I've not used this.
If you want to write a program to do this, you'll have to set up a TCP socket and send an HTTP GET or POST (depending on the command) to the appropriate URL and receive the response.
If you want to do this from perl or python or ruby, there are plenty of 3rd party packages to facilitate sending/receiving HTTP commands/responses. You just have to pick your favorite.
However you do it, you should not assume your API command succeeds. You should always check the response. Even for HTTP 200 responses (which generally means "OK"), you'll want to check the (JSON-formatted) response text for other information that may be important to you later on.
-- sw