Can I stop individual virtual machines in order to avoid billing on your platform? How do I go about doing that?
Can I stop individual virtual machines in order to avoid billing on your platform? How do I go about doing that?
You can stop billing using the "Stop Server" command via the API or using the Data Center Designer. When using the interface, you select a server, and under the Inspect Panel(located on the top right of your screen), you'll find the Power - Stop option. You can choose to Start/Stop multiple servers and then click Provision in order to apply these changes. This process will "deallocate" the cores and RAM, but the storage will still be running for a fast restore.
Below is an CURL example on stopping the server via the API:
#!/bin/bash
XML="
<soapenv:Envelope \
xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' \
xmlns:ws='http://ws.api.profitbricks.com/'> \
<soapenv:Header /> \
<soapenv:Body> \
<ws:stopServer> \
<serverId>server-id</serverId> \
</ws:stopServer> \
</soapenv:Body> \
</soapenv:Envelope> \
"
USERNAME='username@yourdomain.com'
PASSWORD='username-password'
URL='https://api.profitbricks.com/1.3'
ENCODED=`echo -n ${USERNAME}:${PASSWORD} | base64`
curl --data "$XML" --header "Authorization: Basic $ENCODED" --header 'Content-Type: text/xml; charset=utf-8' $URL
For more details about using the API please check this section out: Server Operations.
You could also Start/Stop a server using the Libcloud library. For more details please take a look at this article: How to Correctly Use Stop, Start, Reset on ProfitBricks