Skip to content

Commit ce8812e

Browse files
committed
basic_example_v1: move how-to-run.txt into README.md with syntax updates
1 parent 8d0b059 commit ce8812e

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
Running this sample with the managed YDB instance in Yandex Cloud
2-
*********************************************************************************
2+
---
33

44
(0) Install the yc command line tool
55
https://cloud.yandex.ru/docs/cli/operations/install-cli
66

77
(1) Create the service account using the YC Web Console, and assign it the ydb.editor role.
88
Alternatively use the following shell snippet:
99

10+
```bash
1011
# Specify the Yandex Cloud folder and service account name
1112
export YC_FOLDER=mzinal
1213
export SA_NAME=ydb-sa-0
@@ -16,24 +17,33 @@ yc iam service-account create $SA_NAME
1617
export SA_ID=`yc iam service-account get --name $SA_NAME | sed -n 's/^id: \(.*\)$/\1/p'`
1718
# Assign the ydb.editor role for the specified YC folder to the service account just created
1819
yc resource-manager folder add-access-binding $YC_FOLDER --role ydb.editor --subject serviceAccount:$SA_ID
20+
```
1921

2022
(2) Generate the service account key to be used for authentication.
2123
Note: unfortunately, right now YC Web Console does not offer a way to generate the SA key
2224
with its Web interface.
2325

26+
```bash
2427
yc iam key create --service-account-name $SA_NAME --output $HOME/key-ydb-sa-0.json
28+
```
2529

2630
(3) Obtain the endpoint and database path from the Web Console.
27-
Alternatively, use the following command to grab it in the shell:
31+
Alternatively, use the following command to grab the required data in the shell:
2832

29-
yc ydb db get --name ydb406
33+
```bash
34+
yc ydb db get --name ydb1
35+
```
36+
37+
`ydb1` value in the command above is the logical name of the YDB managed database.
3038

3139
(4) Run the sample:
3240

41+
```bash
3342
# Set the path to the service account key file
3443
export YDB_SERVICE_ACCOUNT_KEY_FILE_CREDENTIALS=$HOME/key-ydb-sa-0.json
3544
# Set the database path and its endpoint
3645
export YDB_ENDPOINT=grpcs://ydb.serverless.yandexcloud.net:2135
3746
export YDB_DATABASE=/ru-central1/b1gfvslmokutuvt2g019/etnvbffeqegu1ub2rg2o
3847
# Run the script
3948
python3 __main__.py -e $YDB_ENDPOINT -d $YDB_DATABASE
49+
```

0 commit comments

Comments
 (0)