Help


Documentation & Tutorials

How to Activate the Protect Server Feature

Protect Server Overview

The Protect Server feature is used to protect your server in a way that it prevents any halt action to be performed on your server. The Protect Server feature only applies to running servers.

For instance, if you server has the protect server option enabled, you will not be able to delete, archive, reboot or use the stop-in-place option. A pop up displays server is protected.

This option can become handy to avoid hazardous manipulations (e.g., batch deletion of servers).

Requirements:

Activating the Protect Server Feature via the Console

1 . On you Server Dashboard, select the running server you want to protect

2 . Once the server details are displayed, scroll down to Advanced and click Show. Advanced configurations are listed.

3 . On the protect server field, click ON to enable the feature.

protect_server.png

The protected server is easily identifiable as a lock icon appears in the protected column.

lock_server.png

Activating the Protect Server Feature via the API

1 . Generate a token from your Scaleway console, if you do not have one yet.

2 . Define a SCW_TOKEN variable from your token id

export SCW_TOKEN='token_uuid'

3 . Retrieve your organization ID through the API. Replace the X-Auth-Token value with your generated token.

% curl https://account.scaleway.com/organizations -H "X-Auth-Token: fa633f07-c2e9-4f06-b651-011d5330e58f"

{
  "organizations": [
    {
->    "id": "000a115d-2852-4b0a-9ce8-47f1134ba95a",
      "name": "jsnow@got.wint",
      "users": [
        {
          ...
        }
      ]
    }
  ]
}

In the above example, the organization ID is 000a115d-2852-4b0a-9ce8-47f1134ba95a.

4 . Define a variable $SCW_ORG for your organization id

export SCW_ORG=‘organisation_uuid'

5 . Depending on your instance location, you can use the base URL https://cp-par1.scaleway.com or https://cp-ams1.scaleway.com

6 . Define a variable for your server id

export SCW_SERVER=’server_id'

7 . To protect an existing server, launch

curl \
  -H "X-Auth-Token: $SCW_TOKEN" \
  -H "Content-Type: application/json;charset=utf-8" \
  -XPATCH https://cp-par1.scaleway.com/servers/$SCW_SERVER \
  -d '{"protected": true}'

8 . To get a protected server status, launch

Get protected server status:
curl \
-H "X-Auth-Token: $SCW_TOKEN" \
-H "Content-Type: application/json;charset=utf-8" \
-XPATCH https://cp-par1.scaleway.com/servers/$SCW_SERVER \

jq .server.protected

9 . To unprotect an existing server, launch

curl \
-H "X-Auth-Token: <token_id>" \
-H "Content-Type: application/json;charset=utf-8" \
-XPATCH https://cp-par1.scaleway.com/servers/$SCW_SERVER \
-d '{"protected": false}'

You can also create new START1-S protected server by default using:

curl \
  -XPOST \
  -H "X-Auth-Token: $SCW_TOKEN" \
  -H 'Content-Type: application/json' \
https://cp-par1.scaleway.com/servers \
  -d \
    "

{\"organization\": \"$SCW_ORG\",       \"name\": \"test-server-post-protected\",       \"image\": \"89457135-d446-41ba-a8df-d53e5bb54710\",       \"commercial_type\": \"START1-S\",       \"tags\": [],       \"boot_type\": \"local\",       \"protected\": true     }
"

Discover a New Cloud Experience

Deploy SSD Cloud Servers in seconds.