Annotations API
Scaleway Annotations lets you attach custom key‑value metadata to any cloud resource (instance, bucket, database, etc.). Use Annotations to start organizing your Scaleway resources now, setting up your infrastructure for our next-generation FinOps, GreenOps, and governance tools.
This product is currently in Beta.
Concepts
Annotation
An annotation is custom metadata you can attach to any Scaleway resource (instance, bucket, database, etc.). It consists of a key (the category of information for a resource) and a value (the concrete information associated with a category).
Key-Value
An annotation key is a globally-unique identifier that names the piece of metadata you want to attach to a resource. The key defines the category of information for a resource (e.g., team, environment, cost-center).
An annotation value is the concrete information (e.g., marketing, production, 83546) associated with a category, i.e., an annotation key. A value cannot exist on its own, it must always be a child of a key.
For example:
| Key | Value |
|---|---|
| team | marketing, finance, sales |
| environment | staging, production |
| cost-center | 83546, 32424, 47847 |
A key-value pair constitutes an annotation.
Binding
A binding is the explicit association that links an annotation to a specific resource. In other words, a binding records which resource the annotation applies to.
Scaleway Resource Name
A Scaleway Resource Name (SRN) is a Uniform Resource Identifier (URI) that uniquely identifies a Scaleway resource.
In the context of Annotations, you are required to provide an SRN when binding a key-value pair to a selected resource via the Annotations API.
An SRN usually follows this format:
Code
Examples:
Code
For detailed information about how SRNs are composed, see Scaleway Resource NamesOpen in new context.
Quickstart
Requirement
- You have your Organization IDOpen in new context
- You have created an API keyOpen in new context and the API key has sufficient IAM permissionsOpen in new context to perform the actions described on this page. To start using Annotations, configure one of the following permission sets:
AnnotationsFullAccess: Full access to annotations (keys, values, and bindings).AnnotationsReadOnly: Read-only access to annotations. Typical users are auditors or finance team members (e.g., a FinOps analyst who can view and filter by annotation but cannot modify anything).AnnotationsBindingManager: Allows attaching annotations to resources, but prohibits modifying the annotation dictionary. Typical users are developers (including Terraform) who need the dictionary for autocomplete and must be able to create/delete bindings, but must not add or modify keys/values.
- You have installed
curlOpen in new context
In the following steps, you are going to create a key-value pair (example: service, payment), bind it to a given resource, then list your organization's bindings.
-
Configure your environment variables.
Note
This is an optional step to simplify your usage of the Annotations API.
Code -
Run the following command to create an annotation key. Remember to replace the placeholders with actual values.
CodeExample response:
CodeNote the key
idreturned in the response, you will need it in the next step. -
Run the following command to add a value to the key. Remember to replace the placeholders with actual values.
CodeExample response:
CodeNote the value
idreturned in the response, you will need it in the next step. -
Attach a key-value pair to a selected cloud resource. Remember to replace the placeholders with actual values.
CodeExample response:
Code -
Run the following command to list bindings (i.e., the annotations attached to your resources). Remember to replace the placeholder with an actual value.
CodeExample response:
Code
Technical information
Regions
Scaleway's infrastructure spans different regions and Availability ZonesOpen in new context.
Annotations is a global product that is available in all regions.
Technical limitations
Validation rules
| Element | Maximum length | Allowed values |
|---|---|---|
key name | 128 characters | [a-zA-Z0-9+.-_:/@] |
value name | 256 characters | [a-zA-Z0-9+.-_:/@] |
description | 1024 characters | No restrictions |
All list endpoints return items sorted alphabetically by name.
Integrity rules
- Strict binding: A resource can only have one value per key.
- No orphans:
- You cannot delete a key if it has values.
- You cannot delete a value if it has bindings.
Consumption limits
| Element | Limit |
|---|---|
| Number of keys per organization | 100 |
| Number of values per key | 200 |
| Number of values per organization | 5,000 |
| Number of bindings per resource | 50 |