Using the SDK for Bash functions
The runtime environment comes with the Yandex Cloud CLI utility 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 the Yandex Cloud CLI commands to be executed successfully, use the --folder-id or --cloud-id parameters to specify the folder or cloud ID, respectively.
The runtime environment comes with pre-installed AWS CLI version 2
- Create a static access key for the service account.
- Save the static access key to a Yandex Lockbox secret.
- Provide the Yandex Lockbox secret to a function.
For more information and examples of commands, see AWS Command Line Interface and the relevant documentation of AWS-compatible Yandex Cloud services.