Using the SDK for Bash functions
The runtime environment has the Yandex Cloud CLI installed by default to work with the Yandex Cloud API.
The user interacts with Yandex Cloud services using the service account specified in the Bash function. This does not require any additional actions from the user: the utility applies the service account automatically.
For example, you can get a list of cloud folders using the following script:
#!/bin/bash
set -e
HOME=/tmp yc --format json resource-manager folder list --cloud-id <cloud_ID> | jq -c '{body:. | tostring}'
For YC CLI commands to run successfully, make sure they specify the appropriate folder or cloud ID with the --folder-id
or --cloud-id
flag, respectively.
To work with Yandex Cloud compatible services, such as Yandex Object Storage and Yandex Message Queue, the runtime environment comes with pre-installed AWS CLI version 2
In this case, copy the static access keys for the service account and provide them, e.g., using the function's environment variables.
For more information and sample commands, see AWS Command Line Interface and the Yandex Message Queue documentation.