Skip to navigationSkip to main contentSkip to footerScaleway Docs HomepageAsk our AI
Ask our AI

Tag Instances hosting healthcare data (HDS) using the CLI or API

When hosting healthcare data using Scaleway Instances, you are legally obligated to add the HDS tag to every Instance within your HDS scope. This page explains how to add this tag using the Scaleway CLI, the Instances API, and Terraform.

To tag Instances using the Scaleway console, see Tag Instances hosting healthcare data.

Important

Updating tags replaces the whole tag list. There is no operation to add a single tag. To tag an existing Instance, you must send the complete list of tags: the existing tags and HDS. If you only send HDS, all other tags are deleted.

Before you start

To complete the actions presented below, you must have:

Note

The HDS scope is restricted to the France - Paris region. Check the default zone of your CLI profile, scripts, and automation tools. A volume, snapshot, or backup created in the nl-ams, pl-waw, or it-mil Availability Zones is outside the HDS scope, even if the Instance is correctly tagged.

Tag Instances using the Scaleway CLI

Tag a new Instance

Run the following command to create an Instance with the HDS tag. Replace <INSTANCE_TYPE> with an HDS-eligible Instance type, and <INSTANCE_NAME> with the name of your Instance.

scw instance server create \
  zone=fr-par-1 \
  image=ubuntu_noble \
  type=<INSTANCE_TYPE> \
  name=<INSTANCE_NAME> \
  tags.0=HDS

Tag an existing Instance

  1. Run the following command to list the current tags of the Instance. Replace <instance-id> with the ID of your Instance.

    scw instance server get <instance-id> zone=fr-par-1 -o json | jq -r '.tags[]'
  2. Run the following command to apply the complete list of tags: HDS and each existing tag.

    scw instance server update <INSTANCE_ID> \
      zone=fr-par-1 \
      tags.0=HDS \
      tags.1=<EXISTING_TAG_1> \
      tags.2=<EXISTING_TAG_2>

Tag all Instances of a zone

The following script adds the HDS tag to every Instance of the selected zone that does not have it yet, and keeps the existing tags.

Important

This script tags all Instances of the zone. Only run it if all Instances of the zone are within your HDS scope.

ZONE=fr-par-1

# List the IDs of the Instances without the HDS tag
for id in $(scw instance server list zone=$ZONE -o json \
  | jq -r '.[] | select((.tags | index("HDS")) | not) | .id'); do

  # Read the existing tags, one per line
  existing_tags=$(scw instance server get "$id" zone=$ZONE -o json | jq -r '.tags[]')

  # Build the complete tag list: HDS first, then the existing tags
  args=("tags.0=HDS")
  if [[ -n "$existing_tags" ]]; then
    i=1
    while read -r tag; do
      args+=("tags.$i=$tag")
      i=$((i + 1))
    done <<< "$existing_tags"
  fi

  scw instance server update "$id" "${args[@]}" zone=$ZONE
done

Check tagged Instances

Run the following command to list the Instances with the HDS tag in a zone:

scw instance server list zone=fr-par-1 -o json | jq -r '.[] | select(.tags | index("HDS")) | .id'

Run the following command to display the details of an Instance, including its tags field:

scw instance server get <INSTANCE_ID> zone=fr-par-1

Tag Instances using the Instances API

  1. Run the following commands to export the variables used in the API requests. Replace <your-secret-key> with the secret key of your API key, and <instance-id> with the ID of your Instance.

    export SCW_SECRET_KEY="<YOUR_SECRET_KEY>"
    export SCW_ZONE="fr-par-1"
    export SERVER_ID="<INSTANCE_ID>"
  2. Run the following command to retrieve the current tags of the Instance.

    curl -s \

-H "X-Auth-Token: $SCW_SECRET_KEY"
"https://api.scaleway.com/instance/v2alpha1/zones/$SCW_ZONE/servers/$SERVER_ID (External link)"
| jq '.tags'

2. Run the following command to apply the complete list of tags: `HDS` and each existing tag.

```bash
curl -X PATCH \
  -H "X-Auth-Token: $SCW_SECRET_KEY" \
  -H "Content-Type: application/json" \
  -d '{"tags": ["HDS", "<existing-tag-1>", "<existing-tag-2>"]}' \
  "https://api.scaleway.com/instance/v2alpha1/zones/$SCW_ZONE/servers/$SERVER_ID"

To tag a new Instance, add "tags": ["HDS"] to the body of the POST /instance/v2alpha1/zones/{zone}/servers request.

See the Instances API documentation (External link) for more information.

Tag Instances using Terraform

Add the HDS tag to the tags argument of the scaleway_instance_server resource:

resource "scaleway_instance_server" "hds_server" {
  zone  = "fr-par-1"
  type  = "<instance-type>"
  image = "ubuntu_noble"
  tags  = ["HDS"]
}
Tip

Add the HDS tag when you create your Instances, preferably through a template or Terraform module. This keeps the tag consistent across your HDS scope.

Still need help?

Create a support ticket
No Results