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 Compute Cloud
    • All guides
      • Connecting to a VM over SSH
      • Connecting to a VM over SSH using Cloud Shell
      • Exchanging files with VMs
      • Connecting to a VM via RDP
      • Connecting to a VM via PowerShell
        • Creating a VM with OS Login support
        • Configuring OS Login on an existing VM
        • Exporting an SSH certificate
        • Connecting to a VM via OS Login
      • Using Yandex Cloud from within a VM
      • Installing NVIDIA drivers
      • Recovering access to a VM
    • Enabling a software-accelerated network
    • Viewing operations on service resources
    • Viewing metrics in Monitoring
    • NVIDIA driver update guide
  • Yandex Container Solution
  • Access management
  • Pricing policy
  • Terraform reference
  • Metrics Monitoring
  • Audit Trails events
  • Release notes
  1. Step-by-step guides
  2. Using a VM
  3. OS Login
  4. Creating a VM with OS Login support

Creating a VM with OS Login

Written by
Yandex Cloud
Updated at May 19, 2026
View in Markdown

With OS Login, you can provide users and service accounts access to VMs relying solely on the Yandex Identity and Access Management mechanisms. There is no need to upload SSH keys to each new VM when creating it.

Tip

To create VMs with OS Login access and connect to such VMs, enable OS Login at the Yandex Cloud organization level first.

To connect to a virtual machine or Kubernetes node with OS Login access enabled, assign the following roles to the user or service account:

  • compute.osLogin or compute.osAdminLogin role.
  • resource-manager.auditor role or higher for the folder containing the VM instance or Kubernetes node.
  • compute.operator role for connecting via the Yandex Cloud CLI.

You can use either the CLI or a standard SSH client to connect to VMs with OS Login access enabled. The connection can be established using an SSH certificate or SSH key, which first needs to be added to the Yandex Identity Hub user's or service account's OS Login profile.

Note

We recommend creating a local user on the new VM and providing a separate SSH key for that user: this way you will still be able to connect to the VM via SSH even if you disable the OS Login access for it. You can create a local user and provide an SSH key for them using metadata:

For users added via metadata:

  • After enabling access to a VM via OS Login, the keys specified in user-data and ssh-keys are removed from the metadata.
  • After disabling access to a VM via OS Login, the removed keys are recreated.

To create a VM with OS Login:

Management console
CLI
Terraform
API
  1. Enable access via OS Login at the organization level.

  2. Create a VM from a pre-built image with OS Login access support. Such images are available on Yandex Cloud Marketplace.

    When creating a VM, select Access under Access by OS Login. If this option is not available, the selected image does not support OS Login access.

    To be able to connect to the VM via SSH without OS Login, update the VM settings and select Access under SSH key.

  1. Enable access via OS Login at the organization level.

  2. Create a VM from a pre-built image with OS Login access support.

    When creating a VM, specify this parameter for access via OS Login:

    --metadata enable-oslogin=true
    
  1. Enable access via OS Login at the organization level.

  2. Create a VM from a pre-built image with OS Login access support.

    When creating a VM for the yandex_compute_instance resource, specify the following parameter in the metadata parameter section to enable access via OS Login:

    metadata = {
      enable-oslogin = true
    }
    
  1. Enable access via OS Login at the organization level.

  2. Create a VM using the create REST API method for the Instance resource from a public image with OS Login access support:

    When creating the VM, provide enable-oslogin=true in the metadata field.

After the created VM changes its status to Running, you will be able to connect to it via OS Login.

Note

For service accounts, OS Login profiles are not created automatically. To connect to a VM or Kubernetes node on behalf of a service account, you need to manually create an OS Login profile.

Was the article helpful?

Previous
Connecting to a VM via PowerShell
Next
Configuring OS Login on an existing VM
© 2026 Direct Cursus Technology L.L.C.