Community

Shutting down the server to stop billing

How can I stop being billed for a server? Would shutting down the server be sufficient?

 
  • **bold**
  • _italics_
  • `code`
  • ```code block```
  • # Heading 1
  • ## Heading 2
  • > Quote
 

In order to suspend billing for a specific virtual machine you must always use the ProfitBricks API functionality, and not the OS "Shut Off" option. In order do to do this you can either use the API request called "stopServer" or you can use the Data Center Designer. Using the user interface, once you select a server, under the Inspector - Power - Stop Below is a CURL Example using 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 information related to the API, please take a look at the API tutorial, available here.