Yandex Cloud
Search
Discuss with expertTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
    • Cloud Interconnect
    • Cloud Backup
    • Cloud Registry
    • Yandex AI Studio
    • Compute Cloud
    • Object Storage
    • Managed Service for Kubernetes®
    • Yandex BareMetal
    • Smart Web Security
    • Security Deck
    • Managed Service for PostgreSQL
    • Managed Service for ClickHouse®
    • Monium
    • Cloud CDN
    • Network Load Balancer
    • Virtual Private Cloud
    • Cloud DNS
    • Application Load Balancer
    • Yandex Cloud Video
    • Stackland
    • Yandex Cloud Router
    • Yandex Managed Service for Trino
    • Managed Service for MySQL®
    • Managed Service for Valkey™
    • Managed Service for Apache Spark™
    • Yandex StoreDoc
    • Managed Service for OpenSearch
    • Managed Service for Apache Kafka®
    • Data Transfer
    • Yandex MPP Analytics Engine for PostgreSQL
    • Yandex Managed Service for Apache Airflow®
    • Data Processing
    • Yandex MetaData Hub
    • Managed Service for YDB
    • Managed Service for Sharded PostgreSQL
    • Managed Service for YTsaurus
    • Yandex WebSQL
    • DataLens
    • Yandex Search API
    • SpeechSense
    • SpeechKit
    • DataSphere
    • Vision OCR
    • Translate
    • Yandex Identity Hub
    • Key Management Service
    • Certificate Manager
    • Yandex Lockbox
    • Audit Trails
    • SmartCaptcha
    • Cloud Desktop
    • SourceCraft Code Assistant
    • Container Registry
    • Managed Service for GitLab
    • Managed Service for Prometheus®
    • Cloud Functions
    • API Gateway
    • Yandex Cloud Postbox
    • Message Queue
    • Serverless Integrations
    • IoT Core
    • Data Streams
    • Serverless Containers
    • Cloud Notification Service
    • Yandex Query
    • Identity and Access Management
    • Yandex Cloud Console
    • Resource Manager
    • Yandex Cloud Billing
    • Yandex Cloud Quota Manager
    • Cloud Apps
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Identity and Access Management
    • All guides
    • Handling secrets that are available in the public domain
    • Users
    • User groups
      • Creating a service account
      • Viewing the folder's service accounts
      • Updating a service account
      • Assigning roles to a service account
      • Setting up service account access permissions
      • Using impersonation
      • Getting service account info
      • Getting an ID token for a service account
      • Deleting a service account
  • Secure use of Yandex Cloud
  • Access management
  • Pricing policy
  • Role reference
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes

In this article:

  • Create a service account
  • Examples
  • Add a description when creating a service account
  1. Step-by-step guides
  2. Service accounts
  3. Creating a service account

Creating a service account

Written by
Yandex Cloud
Improved by
Danila N.
Updated at July 8, 2026
View in Markdown
  • Create a service account
  • Examples
    • Add a description when creating a service account

Warning

Creating service accounts may be prohibited by access policies at the folder, cloud, or organization level.

Create a service account to manage resources under a different account.

You must have the iam.serviceAccounts.admin role or higher for the folder to create a service account.

Note

A service account is created inside a folder. Once a service account has been created, you cannot change the folder.

You can assign roles to a service account for any resources in any cloud if these resources belong to the same organization as the service account. You can also assign roles to a service account for the organization.

Create a service accountCreate a service account

Management console
CLI
Terraform
API
  1. In the management console, click or in the top panel and select the folder.

  2. Navigate to Identity and Access Management.

  3. Click Create service account.

  4. Enter a name for the service account.

    The naming requirements are as follows:

    • Length: between 3 and 63 characters.
    • It can only contain lowercase Latin letters, numbers, and hyphens.
    • It must start with a letter and cannot end with a hyphen.

    Make sure the service account name is unique within your cloud.

  5. Click Create.

If you do not have the Yandex Cloud CLI yet, install and initialize it.

The folder used by default is the one specified when creating the CLI profile. To change the default folder, use the yc config set folder-id <folder_ID> command. You can also specify a different folder for any command using --folder-name or --folder-id. If you access a resource by its name, the search will be limited to the default folder. If you access a resource by its ID, the search will be global, i.e., through all folders based on access permissions.

  1. View the description of the command for creating a service account:

    yc iam service-account create --help
    
  2. Create a service account named my-robot:

    yc iam service-account create --name my-robot
    

    The naming requirements are as follows:

    • Length: between 3 and 63 characters.
    • It can only contain lowercase Latin letters, numbers, and hyphens.
    • It must start with a letter and cannot end with a hyphen.

If you do not have Terraform yet, install it and configure the Yandex Cloud provider.

To manage infrastructure using Terraform under a service account or user accounts (a Yandex account, a federated account, or a local user), authenticate using the appropriate method.

  1. In the configuration file, specify the properties of the resources you want to create:

    resource "yandex_iam_service_account" "sa" {
      name        = "<service_account_name>"
      description = "<service_account_description>"
      folder_id   = "<folder_ID>"
    }
    
    • name: Service account name. This is a required parameter.
    • description: Service account description. This is an optional setting.
    • folder_id: Folder ID. This is an optional setting. It defaults to the value specified in the provider settings.

    For more on the properties of the yandex_iam_service_account resource in Terraform, see this provider guide.

  2. Make sure the configuration files are correct.

    1. In the terminal, navigate to the directory where you created your configuration file.

    2. Run a check using this command:

      terraform plan
      

    If the configuration description is correct, the terminal will display information about the service account. Otherwise, Terraform will show any detected errors.

  3. Deploy the cloud resources.

    1. If the configuration is correct, run this command:

      terraform apply
      
    2. Confirm creating the service account by typing yes in the terminal and pressing Enter.

      This will create the service account. You can check it using the management console or this CLI command:

      yc iam service-account list
      

To create a service account, use the create REST API method for the ServiceAccount resource or the ServiceAccountService/Create gRPC API call.

ExamplesExamples

Add a description when creating a service accountAdd a description when creating a service account

Create a service account with the following name and description:

CLI
Terraform
API
yc iam service-account create --name my-robot \
  --description "this is my favorite service account"
 resource "yandex_iam_service_account" "sa" {
   name        = "my-robot"
   description = "this is my favorite service account"
 }
curl \
  --request POST \
  --header 'Content-Type: application/json' \
  --header "Authorization: Bearer <IAM_token>" \
  --data '{
    "folderId": "b1gvmob95yys********",
    "name": "my-robot",
    "description": "this is my favorite service account"
  }' \
  https://iam.api.cloud.yandex.net/iam/v1/serviceAccounts

Useful linksUseful links

  • Getting a list of the folder's service accounts
  • Assigning roles to a service account
  • Setting up service account access permissions
  • Service account keys

Was the article helpful?

Previous
User groups
Next
Viewing the folder's service accounts
© 2026 Direct Cursus Technology L.L.C.