Authorization in Yandex.Cloud
When a user does something with a resource in Yandex.Cloud, IAM checks whether the user has the necessary access rights to perform this operation.
Users get permissions along with resource roles. For more information about how roles are assigned and how the list of permissions is checked, see How access management in Yandex.Cloud works.
Authentication in Yandex.Cloud
Before authorization, a user must get authenticated, i.e., log in under their account. Authentication is performed in different ways, depending on the type of account and the interface used.
Authentication with a Yandex.Passport account
Authentication is carried out automatically when you log in to your Yandex or Yandex.Connect account.
If you are the owner of the cloud and you use your own account to access the API, remember that the owner of the cloud can perform any operations with cloud resources.
We recommend using a service account to work with the API. This way, you can assign only the roles that are necessary.
To perform operations in the API:
Specify the received IAM token when accessing Yandex.Cloud resources via the API. Pass the IAM token in the
Authorizationheader in the following format:
Authorization: Bearer <IAM-TOKEN>
The IAM token is valid for 12 hours. After that period expires, get a new IAM token.
Service account authentication
To perform operations on behalf of your service account, specify the path to its authorized key in the
service-account-key configuration during profile initialization. The key will be saved in the profile configuration and authentication will work automatically.
There are three ways to perform operations on behalf of a service account:
Using an IAM token. This is the recommended authentication method. However, please note that the IAM token validity is limited. Therefore, this method is suitable for developing applications that will request the IAM token automatically.
Using API keys.
API keys do not expire. This means that this authentication method is simpler, but less secure. Use it if you can't automatically request an IAM token.
Using static access keys. This method should be used in services with an AWS-compatible API, such as Object Storage and Message Queue.