Skip to content

Commit 2d918f4

Browse files
committed
updated readme with metadata instructions
1 parent cbedf9a commit 2d918f4

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Yandex Database supports the following authentication methods:
3030
- OAuth token
3131
- JWT + private key
3232
- JWT + JSON file
33+
- Metadata URL
3334

3435
## OAuth token
3536

@@ -128,6 +129,37 @@ $ydb = new Ydb($config);
128129

129130
```
130131

132+
## Metadata URL
133+
134+
When you deploy a project to VM or function at Yandex.Cloud, you are able to connect to the database using [Metadata URL](https://cloud.yandex.ru/docs/compute/operations/vm-connect/auth-inside-vm). Before you start, you should link your service account to an existing or new VM or function.
135+
136+
```php
137+
<?php
138+
139+
use YandexCloud\Ydb\Ydb;
140+
141+
$config = [
142+
143+
// Database path
144+
'database' => '/ru-central1/b1glxxxxxxxxxxxxxxxx/etn0xxxxxxxxxxxxxxxx',
145+
146+
// Database endpoint
147+
'endpoint' => 'ydb.serverless.yandexcloud.net:2135',
148+
149+
// Auto discovery (dedicated server only)
150+
'discovery' => false,
151+
152+
// IAM config
153+
'iam_config' => [
154+
'temp_dir' => './tmp', // Temp directory
155+
'use_metadata' => true,
156+
],
157+
];
158+
159+
$ydb = new Ydb($config);
160+
161+
```
162+
131163

132164
# Usage
133165

0 commit comments

Comments
 (0)