Skip to content

Commit 7a29f5a

Browse files
committed
update guide
1 parent f7e17ef commit 7a29f5a

File tree

6 files changed

+92
-44
lines changed

6 files changed

+92
-44
lines changed

pages/public_cloud/ai_machine_learning/deploy_guide_03_tokens/guide.en-gb.md

Lines changed: 92 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: AI Deploy - Accessing your app with tokens
3-
excerpt: Discover how to create a scoped token and query your AI Deploy app
4-
updated: 2023-04-04
3+
excerpt: Learn how to create scoped tokens to securely access your AI Deploy applications
4+
updated: 2025-07-28
55
---
66

77
> [!primary]
@@ -13,92 +13,136 @@ updated: 2023-04-04
1313

1414
This guide covers the creation of application tokens for AI Deploy.
1515

16+
This is particularly useful when you want to make your app accessible to others without sharing your username and password. Moreover, using tokens facilitates the integration of your app with other services or scripts, such as those using curl, allowing for a more automated and flexible interaction with your AI Deploy application.
17+
18+
In this tutorial, we will create and assign tokens to a basic AI Deploy app, running the [infrastructureascode/hello-world](https://hub.docker.com/r/infrastructureascode/hello-world) Docker image.
19+
1620
## Requirements
1721

1822
- a **Public cloud** project
1923
- access to the [OVHcloud Control Panel](/links/manager)
20-
- a Running AI Deploy app (the deployed app in this guide uses the Docker image [infrastructureascode/hello-world](https://hub.docker.com/r/infrastructureascode/hello-world))
2124

2225
## Instructions
2326

24-
### Adding labels to an App
27+
By default, the 2 following labels are systematically added to each AI Deploy application:
2528

26-
Tokens are scoped based on labels added to your AI Deploy app. To scope a token you need to add a label to your AI Deploy app upon submission.
29+
- `ovh/id` whose value is the ID of the AI Deploy app
30+
- `ovh/type` whose value is `app`, the type of AI resource
2731

28-
![app add label](images/01-app-add-label.png){.thumbnail}
32+
> [!primary]
33+
> These labels are prefixed by `ovh/`, meaning these are reserved by the platform. These labels will be automatically overwritten by the platform if you attempt to redefine them during submission. They won't be displayed in the manager UI.
2934
30-
In this instance we add the label `group=A` to the AI Deploy app. In addition to this, the 2 following labels are systematically added by default to each AI Deploy application:
35+
In addition to these default labels, you can **create new ones** to further customize and secure your application access.
3136

32-
- `ovh/id` whose value is the ID of the AI Deploy app
33-
- `ovh/type` with value `app`, the type of AI resource
37+
### Adding labels to an app
3438

35-
> [!primary]
36-
> These labels are prefixed by `ovh/`, meaning these are reserved by the platform. Those labels are overriden upon submission if any are provided.
39+
Tokens are scoped based on labels added to your AI Deploy app. To scope a token, you must add a label to your AI Deploy app. This can be done either during the app creation process or after the app is deployed. You can add multiple labels by repeating the following process.
3740

38-
All the labels of an AI Deploy app are listed on the AI Deploy app details under **Tags**:
41+
#### Adding label during app creation
3942

40-
![app dashboard](images/02-app-dashboard.png){.thumbnail}
43+
To add a label when creating an AI Deploy app, access the `Advanced Configuration`{.action} step in the app creation process. This section allows you to specify a custom Docker command, the mounted volumes, and **the app labels**.
4144

42-
### Generating tokens
45+
From this last sub-section, you can add a key-value pair. The key is the label identifier (e.g., `group`), while the value is the corresponding value assigned to this key (e.g., `A`). In this tutorial, we use the example `group=A` as the label of the AI Deploy app:
4346

44-
From the **AI Deploy** page, you access the tokens management page by clicking the `Tokens`{.action} tab.
47+
![app add label](images/01-app-add-label.png){.thumbnail}
4548

46-
![app list](images/03-app-list.png)
49+
Once created, all the labels of an AI Deploy app are listed on the app details, under **Labels** field:
4750

48-
Once on the token management tab, simply click on `New Token`{.action}.
51+
![app dashboard](images/02-app-dashboard.png){.thumbnail}
4952

50-
![token list new](images/04-token-list.png){.thumbnail}
53+
#### Adding label to an existing app
54+
55+
If your app is already deployed, you can still add or update labels at any time using the Control Panel (UI) or the `ovhai` CLI.
56+
57+
> [!tabs]
58+
> **Using the Control Panel (UI)**
59+
>>
60+
>> Navigate to the **AI Deploy** section where all your apps are listed. **Click the name of your app** to open its details page. Locate the **Labels** section. Enter the key-value pair and click `+`{.action} to add the label to your app.
61+
>>
62+
>> ![image](images/03-app-add-label-existing-app.png){.thumbnail}
63+
>>
64+
>> After saving, the added label will be visible in the **Labels** section of the app details.
65+
>>
66+
> **Using ovhai CLI**
67+
>>
68+
>> To follow this part, make sure you have installed the [ovhai CLI](/pages/public_cloud/ai_machine_learning/cli_10_howto_install_cli) on your computer or on an instance.
69+
>>
70+
>> You can also add labels to an existing app using the `ovhai` CLI. Run the following command:
71+
>>
72+
>> ```console
73+
>> ovhai app set-label <app_id> <name> <value>
74+
>> ```
75+
>>
76+
>> Replace <app_id> with the unique identifier of your app (found in the app details or by running `ovhai app ls`). And replace <name> and <value> with your desired key and value pair. For example:
77+
>>
78+
>> ```console
79+
>> ovhai app set-label a8318623-8357-48b4-bd3b-648c3e343ec9 group A
80+
>> ```
81+
>>
82+
>> This command adds the label `group=A` to the app with ID `a8318623-8357-48b4-bd3b-648c3e343ec9`.
83+
>>
84+
>> You can verify app labels by running `ovhai app get <app_id>`. Labels will be displayed at the top of app details, in the *Labels* field.
5185
52-
#### Read token
86+
### Generating tokens
5387
54-
There are two types of roles that can be assigned to a token:
88+
From the **AI Dashboard** page, you can access the tokens management page by clicking the `Tokens`{.action} tab. From there, you can click on the `+ Create a token`{.action} button to create a new token:
5589
56-
- AI Platform - Read-only
57-
- AI Platform - Operator
90+
![token list new](images/04-token-list.png){.thumbnail}
5891
59-
A Read-only token will only grant you the right to query the deployed app while an Operator token would also allow you to manage the AI Deploy app itself.
92+
There are two types of roles that can be assigned to a token:
6093
61-
Let us create a token for the AI Deploy apps matching the label `group=A` with read-only access in the GRA cluster.
62-
To create an AI Deploy app token we need to specify 3 parameters:
94+
- **AI Platform - Reader**: allows only querying the app
95+
- **AI Platform - Operator**: allows querying and full lifecycle management (start/stop/delete)
6396
64-
- The token scope is specified through label selectors, and a token will be scoped over any app matching the set of label selectors. In this case `group=A`
65-
- The token role: AI Training - Read-only
66-
- The region (cluster in which are deployed the AI Deploy apps): GRA.
97+
#### Read token
6798
68-
Fill out the form:
99+
Let's create a token for the AI Deploy apps matching the label `group=A` with read-only access in the GRA (Gravelines) cluster. To do this, we will need to fill 4 parameters:
69100
70101
![token generation input read](images/05-token-gen-input-read.png){.thumbnail}
71102
72-
Click `Generate`{.action}. Upon success, you are redirected to the token list with the newly generated token displayed at the top:
73-
74-
![token generation result](images/06-token-gen-result-read.png){.thumbnail}
103+
- **Token name**: used for token identification, management only.
104+
- **Label selector**: determines which apps the token applies to (e.g., `group=A`).
105+
- **Role**: choose from:
106+
- `AI Reader`: read-only
107+
- `AI Operator`: read & manage
108+
- **Region**: e.g., `GRA` (for Gravelines)
75109
76-
Save the token string for later use.
110+
After completing the form, click `Generate`{.action} to confirm token creation.
77111
78112
> [!warning]
79-
> The token is only displayed once, make sure to save it before leaving the page or you will need to regenerate the token.
113+
> You will then receive the value of your new token, which you must **carefully save**, as its value is only displayed once. If you lose the token value, you will need to [regenerate it](#regenerating-a-token).
114+
115+
Then, you will be redirected to the token list with the newly generated token displayed at the top:
116+
117+
![token generation result](images/06-token-gen-result-read.png){.thumbnail}
80118
81119
This newly generated token provides read access over all resources tagged with the label `group=A` including the ones submitted after the creation of the token.
82120
83-
#### Operator token
121+
If you prefer working from the command line, you can generate the same token using the `ovhai` CLI:
84122
85-
An operator token grants read access along with management access for the matching apps. This means that you can manage the AI Deploy app lifecycle (start/stop/delete) using either the CLI (more info [here](/pages/public_cloud/ai_machine_learning/cli_10_howto_install_cli)) or the [AI Training API](https://gra.ai.cloud.ovh.net/) by providing this token.
123+
```console
124+
ovhai token create reader-token --role read --label-selector group=A
125+
```
86126
87-
This Operator token will be scoped on a specific AI Deploy app and we will use the default `ovh/id` label to do so (since it is reserved, there is only one AI Deploy app that can match this label selector).
127+
#### Operator token
88128

89-
- Token scope: `ovh/id=4c4f6253-a059-424a-92da-5e06a12ddffd`
90-
- The token role: AI Training - Operator
91-
- The region: GRA.
129+
An operator token grants read access along with management access for the matching apps. This allows you to manage the AI Deploy app lifecycle (start/stop/delete) using either the CLI (more info [here](/pages/public_cloud/ai_machine_learning/cli_10_howto_install_cli)) or the [AI API](https://gra.ai.cloud.ovh.net/) by providing this token.
92130

93131
![token generation input operator](images/07-token-gen-input-op.png){.thumbnail}
94132

95-
Additional information about the use of a token to manage an AI Training resource can be found [here](/pages/public_cloud/ai_machine_learning/cli_13_howto_app_token_cli#use-the-app-token).
133+
Equivalent CLI command is:
134+
135+
```console
136+
ovhai token create operator-token --role operator --label-selector group=A
137+
```
138+
139+
You can also scope a token to a specific app using `ovh/id` label and the app’s ID as its value. This label is added automatically by default as explained [above](#instructions) and, because it is reserved, it will uniquely match only one app.
96140

97141
### Using a token to query an AI Deploy app
98142

99143
With the token we generated in the previous step, we will now query the app. For this demonstration, we deployed a simple Hello World app that always responds `Hello, World!`.
100144

101-
You can get the access URL of your app in the details of the AI Deploy app, above the **Tags**.
145+
You can get the access URL of your app in the details of the AI Deploy app, above the **Labels**.
102146

103147
#### Browser
104148

@@ -114,7 +158,7 @@ You now land on the exposed AI Deploy app service:
114158

115159
#### Code integration
116160

117-
You can also directly CURL the AI Deploy app using the token as an `Authorization` header:
161+
You can also use CURL to directly query the AI Deploy app using the token as an `Authorization` header:
118162

119163
```bash
120164
export TOKEN=<your-token>
@@ -137,7 +181,7 @@ From the list of tokens, click on the action menu and select `Regenerate`{.actio
137181

138182
![token regenerate](images/08-token-list-regen.png){.thumbnail}
139183

140-
Then click on `Regenerate`{.action} to confirm.
184+
Then click on `Confirm`{.action}:
141185

142186
![token regenerate confirm](images/09-token-regen-confirm.png){.thumbnail}
143187

@@ -147,6 +191,10 @@ If you simply need to invalidate the token, you can delete it using the same act
147191

148192
![token delete](images/10-token-list-delete.png)
149193

194+
## Go further
195+
196+
Additional information about the use of a token to manage AI Solutions using `ovhai` CLI can be found [here](/pages/public_cloud/ai_machine_learning/cli_13_howto_app_token_cli).
197+
150198
## Feedback
151199

152200
Please feel free to send us your questions, feedback and suggestions to help our team improve the service on the OVHcloud [Discord server](https://discord.gg/ovhcloud)
588 Bytes
Loading
93.9 KB
Loading
52.1 KB
Loading
1.93 KB
Loading

0 commit comments

Comments
 (0)