Secure use of Yandex Cloud
This section provides recommendations on how to make the best use of IAM for secure work with Yandex Cloud services.
Do not grant unnecessary access rights
For critical resources:
-
Assign the minimum required roles. For example, to allow the creation of VMs from images in Compute Cloud, assign the
compute.images.userrole rather thaneditoror higher. -
Try to assign service roles rather than primitive ones (
viewer,editor, oradmin). Primitive roles apply to resources in any service Yandex Cloud.Use primitive roles if there is no suitable service role or you want to confer broad authority on a user.
-
Assign only roles you need right now. Do not assign roles you may only need in the future.
-
Note that when you assign a role for a folder, cloud, or organization, all the nested resources will inherit this role's permissions.
-
Assign the administrator or cloud owner roles only to people responsible for managing the access to resources in your project.
An administrator can take away another administrator's access permissions, and an owner can revoke a role from another owner. These roles also include all the
editorpermissions allowing to create, edit, and delete resources.
Protect your Yandex account
To better safeguard your resources from unauthorized access:
- Enable two-factor authentication
for your Yandex account. - Request users you add to your organization to enable two-factor authentication as well.
- In the organization security settings, enable the two-factor authentication requirement. This way, only users with two-factor authentication enabled will be able to access resources.
Use service accounts
Automate your Yandex Cloud operations using service accounts and follow these recommendations:
-
Control access to your service accounts. The
editorrole for a service account allows the user to perform operations that service account is authorized to perform. If the service account is the cloud administrator, the user can use it to make themselves an administrator. -
Create separate service accounts for different tasks. This will allow you to give them only the roles they really need. You can revoke roles from a service account or delete it without affecting other service accounts.
-
Name your service accounts according to their intended purposes and permissions.
-
Keep your service account keys secret: they can be used to perform operations under your service account. Do not keep your service account keys in the source code.
Revoke old keys and issue new ones every now and then. Especially if you know that somebody might have learned your secret key.
-
Do not use your keys for authentication if you can use IAM tokens. Keys have an unlimited lifetime, while IAM tokens are valid for 12 hours.
-
If you perform operations from inside a VM, link a service account to it. Thus you will no longer need to store your service account keys on the VM for authentication: your IAM token will be available by a metadata service link.