Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Solutions
  • Pricing
  • Documentation
  • Contact us
Get started
Command line interface
  • Getting started with the CLI
  • Step-by-step instructions
    • All instructions
    • CLI installation
    • Authentication
      • Authenticating as a user
      • Authenticating as a service account
      • Authenticating as a federated user
    • Profile management
      • Creating a profile
      • Managing profile parameters
      • Getting profile information
      • Activating a profile
      • Deleting a profile
  • Concepts
    • Running commands
    • CLI configuration
    • Synchronous and asynchronous command execution modes
  • CLI releases
  • Troubleshooting
  • CLI reference
    • Overview
    • CLI management
      • init
      • version
      • help
      • config
        • Overview
        • profile
          • Overview
          • get
          • activate
          • delete
          • create
          • list
        • unset
        • set
        • get
        • list
      • components
        • Overview
        • restore
        • update
    • Operations management
      • Overview
      • wait
      • get
    • Services management
      • ydb
        • Overview
        • database
          • Overview
          • delete
          • update
          • restore
          • backup
          • create
          • list
          • get
        • storage-type
          • Overview
          • list
          • get
        • resource-preset
          • Overview
          • list
          • get
        • backup
          • Overview
          • delete
          • list
          • get
      • certificate-manager
        • Overview
        • certificate
          • Overview
          • remove-access-binding
          • add-access-binding
          • set-access-bindings
          • list-access-bindings
          • list-operations
          • delete
          • update
          • request
          • create
          • list
          • content
          • get
      • kms
        • Overview
        • symmetric-crypto
          • Overview
          • re-encrypt
          • generate-data-key
          • decrypt
          • encrypt
        • symmetric-key
          • Overview
          • cancel-version-destruction
          • schedule-version-destruction
          • set-primary-version
          • delete
          • create
          • update
          • list-versions
          • list
          • get
          • rotate
          • remove-access-binding
          • add-access-binding
          • set-access-bindings
          • list-access-bindings
          • list-operations
      • managed-clickhouse
        • Overview
        • user
          • Overview
          • remove-quota
          • update-quota
          • add-quota
          • revoke-permission
          • grant-permission
          • delete
          • create
          • update
          • list
          • get
        • backup
          • Overview
          • list
          • get
        • resource-preset
          • Overview
          • list
          • get
        • ml-model
          • Overview
          • delete
          • update
          • create
          • list
          • get
        • format-schema
          • Overview
          • delete
          • update
          • create
          • list
          • get
        • version
          • Overview
          • list
        • cluster
          • Overview
          • stop
          • start
          • move
          • remove-graphite-rollup
          • remove-external-dictionary
          • add-graphite-rollup
          • add-external-dictionary
          • set-compression
          • clear-compression
          • list-operations
          • list-logs
          • list-backups
          • backup
          • add-zookeeper
          • delete
          • remove-labels
          • add-labels
          • update-config
          • update
          • reschedule-maintenance
          • restore
          • create
          • list
          • get
        • hosts
          • Overview
          • delete
          • add
          • list
        • shards
          • Overview
          • delete
          • update-config
          • update
          • add
          • list
          • get
        • shard-groups
          • Overview
          • delete
          • update
          • create
          • list
          • get
        • database
          • Overview
          • delete
          • create
          • list
          • get
      • managed-mongodb
        • Overview
        • resource-preset
          • Overview
          • list
          • get
        • shards
          • Overview
          • delete
          • add
          • list
          • get
        • backup
          • Overview
          • get
          • list
        • cluster
          • Overview
          • enable-sharding
          • stop
          • start
          • move
          • list-operations
          • list-logs
          • list-backups
          • backup
          • delete
          • remove-labels
          • add-labels
          • update-config
          • update
          • reschedule-maintenance
          • create
          • restore
          • list
          • get
        • hosts
          • Overview
          • resetup
          • add
          • delete
          • list
        • database
          • Overview
          • delete
          • create
          • list
          • get
        • user
          • Overview
          • get
          • revoke-permission
          • grant-permission
          • delete
          • update
          • create
          • list
      • managed-mysql
        • Overview
        • hosts
          • Overview
          • delete
          • add
          • list
        • database
          • Overview
          • delete
          • create
          • get
          • list
        • user
          • Overview
          • revoke-permission
          • delete
          • grant-permission
          • update
          • create
          • list
          • get
        • resource-preset
          • Overview
          • list
          • get
        • cluster
          • Overview
          • stop
          • move
          • list-operations
          • list-logs
          • list-backups
          • backup
          • delete
          • remove-labels
          • add-labels
          • update-config
          • update
          • reschedule-maintenance
          • start-failover
          • restore
          • create
          • list
          • get
          • start
        • backup
          • Overview
          • list
          • get
      • resource-manager
        • Overview
        • folder
          • Overview
          • list-operations
          • remove-access-binding
          • add-access-binding
          • set-access-bindings
          • list-access-bindings
          • remove-labels
          • add-labels
          • update
          • create
          • list
          • get
        • cloud
          • Overview
          • set-access-bindings
          • list-access-bindings
          • update
          • list
          • get
          • add-access-binding
          • list-operations
          • remove-access-binding
      • dns
        • Overview
        • zone
          • Overview
          • remove-access-binding
          • add-access-binding
          • set-access-bindings
          • list-access-bindings
          • list-operations
          • remove-labels
          • add-labels
          • replace-records
          • delete-records
          • list-records
          • add-records
          • delete
          • update
          • list
          • create
          • get
      • vpc
        • Overview
        • security-group
          • Overview
          • update-rule-meta
          • update-rules
          • move
          • list-operations
          • delete
          • remove-labels
          • add-labels
          • update
          • create
          • list
          • get
        • route-table
          • Overview
          • move
          • list-operations
          • delete
          • remove-labels
          • add-labels
          • update
          • create
          • list
          • get
        • subnet
          • Overview
          • move
          • list-used-addresses
          • list-operations
          • delete
          • remove-labels
          • add-labels
          • update
          • create
          • list
          • get
        • address
          • Overview
          • list-operations
          • delete
          • update
          • create
          • list
          • get
        • network
          • Overview
          • update
          • create
          • list
          • get
          • move
          • list-operations
          • list-subnets
          • delete
          • remove-labels
          • add-labels
      • managed-postgresql
        • Overview
        • backup
          • Overview
          • list
          • get
        • resource-preset
          • Overview
          • list
          • get
        • cluster
          • Overview
          • stop
          • start
          • move
          • list-operations
          • list-logs
          • list-backups
          • delete
          • backup
          • remove-labels
          • add-labels
          • update-config
          • update
          • reschedule-maintenance
          • start-failover
          • restore
          • create
          • list
          • get
        • hosts
          • Overview
          • update-config
          • delete
          • update
          • add
          • list
        • database
          • Overview
          • delete
          • update
          • create
          • get
          • list
        • user
          • Overview
          • get
          • list
          • revoke-permission
          • grant-permission
          • delete
          • update
          • create
      • managed-sqlserver
        • Overview
        • backup
          • Overview
          • list
          • get
        • resource-preset
          • Overview
          • list
          • get
        • host
          • Overview
          • list
        • cluster
          • Overview
          • start
          • stop
          • list-operations
          • list-backups
          • backup
          • delete
          • remove-labels
          • add-labels
          • update-config
          • update
          • create
          • restore
          • list
          • get
        • database
          • Overview
          • delete
          • create
          • list
          • get
        • user
          • Overview
          • grant-permission
          • create
          • update
          • list
          • get
          • revoke-permission
          • delete
      • dataproc
        • Overview
        • job
          • Overview
          • create-hive
          • create-mapreduce
          • create-pyspark
          • create-spark
          • log
          • get
          • list
        • resource-preset
          • Overview
          • get
          • list
        • subcluster
          • Overview
          • delete
          • create
          • list
          • get
          • update
        • cluster
          • Overview
          • list-operations
          • list-ui-links
          • list-hosts
          • stop
          • start
          • delete
          • remove-labels
          • add-labels
          • update
          • create
          • list
          • get
      • managed-redis
        • Overview
        • hosts
          • Overview
          • delete
          • add
          • list
        • cluster
          • Overview
          • reschedule-maintenance
          • start-failover
          • restore
          • create
          • list
          • get
          • update
          • stop
          • start
          • move
          • list-operations
          • list-logs
          • list-backups
          • rebalance
          • backup
          • delete
          • remove-labels
          • update-config
          • add-labels
        • resource-preset
          • Overview
          • get
          • list
        • shards
          • Overview
          • delete
          • add
          • list
          • get
        • backup
          • Overview
          • list
          • get
      • managed-elasticsearch
        • Overview
        • cluster
          • Overview
          • remove-labels
          • add-labels
          • update-config
          • update
          • stop
          • start
          • list-operations
          • list-logs
          • delete
          • create
          • list
          • get
        • hosts
          • Overview
          • delete
          • add
          • list
        • resource-preset
          • Overview
          • list
          • get
        • user
          • Overview
          • delete
          • update
          • create
          • list
          • get
      • application-load-balancer
        • Overview
        • backend-group
          • Overview
          • delete-http-backend
          • update-http-backend
          • add-http-backend
          • delete
          • update
          • create
          • list
          • get
        • http-router
          • Overview
          • delete
          • update
          • create
          • list
          • get
        • virtual-host
          • Overview
          • insert-http-route
          • remove-http-route
          • prepend-http-route
          • append-http-route
          • delete
          • update
          • create
          • list
          • get
        • target-group
          • Overview
          • remove-targets
          • add-targets
          • delete
          • update
          • create
          • list
          • get
        • load-balancer
          • Overview
          • get
          • target-states
          • remove-location
          • add-location
          • enable-traffic
          • list-operations
          • disable-traffic
          • update-sni
          • add-sni
          • remove-sni
          • remove-listener
          • update-listener
          • add-listener
          • delete
          • update
          • create
          • list
      • managed-kafka
        • Overview
        • user
          • Overview
          • delete
          • update
          • create
          • list
          • get
        • cluster
          • Overview
          • update
          • create
          • stop
          • start
          • list-hosts
          • list-operations
          • delete
          • list
          • get
        • topic
          • Overview
          • delete
          • update
          • create
          • list
          • get
      • load-balancer
        • Overview
        • network-load-balancer
          • Overview
          • list-operations
          • remove-listener
          • add-listener
          • target-states
          • detach-target-group
          • attach-target-group
          • stop
          • start
          • delete
          • update
          • create
          • list
          • get
        • target-group
          • Overview
          • list-operations
          • remove-targets
          • add-targets
          • delete
          • create
          • update
          • list
          • get
      • iam
        • Overview
        • federation
          • Overview
          • list-operations
          • list-user-accounts
          • add-user-accounts
          • delete
          • update
          • create
          • list
          • get
        • certificate
          • Overview
          • delete
          • list-operations
          • update
          • create
          • get
          • list
        • key
          • Overview
          • delete
          • create
          • list
          • get
        • access-key
          • Overview
          • delete
          • create
          • list
          • get
        • user-account
          • Overview
          • get
        • api-key
          • Overview
          • delete
          • create
          • list
          • get
        • role
          • Overview
          • list
          • get
        • service-account
          • Overview
          • create
          • get
          • list
          • list-operations
          • remove-access-binding
          • add-access-binding
          • set-access-bindings
          • list-access-bindings
          • delete
          • update
        • create-token
      • compute
        • Overview
        • instance
          • Overview
          • list-operations
          • add-one-to-one-nat
          • remove-one-to-one-nat
          • update-network-interface
          • detach-disk
          • attach-new-disk
          • attach-disk
          • restart
          • start
          • stop
          • get-serial-port-output
          • delete
          • remove-labels
          • remove-metadata
          • add-labels
          • add-metadata
          • update-container
          • update
          • create-with-container
          • create
          • list
          • get
        • disk
          • Overview
          • add-labels
          • update
          • create
          • list
          • get
          • list-operations
          • delete
          • resize
          • remove-labels
        • host-type
          • Overview
          • list
          • get
        • disk-placement-group
          • Overview
          • list-operations
          • list-disks
          • delete
          • remove-labels
          • add-labels
          • update
          • create
          • list
          • get
        • host-group
          • Overview
          • list-operations
          • list-instances
          • list-hosts
          • delete
          • remove-labels
          • add-labels
          • update
          • create
          • list
          • get
        • image
          • Overview
          • list-operations
          • delete
          • remove-labels
          • add-labels
          • update
          • create
          • get-latest-from-family
          • list
          • get
        • disk-type
          • Overview
          • list
          • get
        • snapshot
          • Overview
          • list-operations
          • delete
          • remove-labels
          • add-labels
          • update
          • create
          • list
          • get
        • zone
          • Overview
          • list
          • get
        • placement-group
          • Overview
          • list-operations
          • list-instances
          • remove-labels
          • delete
          • add-labels
          • update
          • create
          • list
          • get
        • instance-group
          • Overview
          • stop-instances
          • list-instances
          • delete
          • remove-labels
          • add-labels
          • remove-metadata
          • add-metadata
          • start
          • stop
          • update
          • create
          • list
          • get
          • remove-access-binding
          • add-access-binding
          • set-access-bindings
          • list-access-bindings
          • list-logs
          • list-operations
          • delete-instances
        • connect-to-serial-port
      • managed-kubernetes
        • Overview
        • cluster
          • Overview
          • list-nodes
          • list-operations
          • start
          • stop
          • delete
          • remove-labels
          • update
          • add-labels
          • create
          • list
          • get
          • get-credentials
          • list-node-groups
        • node-group
          • Overview
          • list-nodes
          • list-operations
          • remove-labels
          • delete
          • add-labels
          • remove-metadata
          • add-metadata
          • update
          • create
          • list
          • get
        • list-versions
        • create-token
      • container
        • Overview
        • cluster
          • Overview
          • list-nodes
          • list-operations
          • list-node-groups
          • start
          • stop
          • delete
          • remove-labels
          • add-labels
          • update
          • create
          • list
          • get
          • get-credentials
        • node-group
          • Overview
          • list-nodes
          • list-operations
          • delete
          • remove-labels
          • remove-metadata
          • add-labels
          • add-metadata
          • update
          • create
          • list
          • get
        • registry
          • Overview
          • configure-docker
          • remove-ip-permissions
          • add-ip-permissions
          • set-ip-permissions
          • list-ip-permissions
          • remove-access-binding
          • add-access-binding
          • set-access-bindings
          • list-access-bindings
          • delete
          • remove-labels
          • add-labels
          • update
          • create
          • list
          • get
        • image
          • Overview
          • scan
          • delete
          • list
          • get
          • get-scan-result
          • list-vulnerabilities
          • list-scan-results
          • get-last-scan-result
        • repository
          • Overview
          • lifecycle-policy
            • Overview
            • list-dry-run-affected-images
            • get-dry-run-result
            • list-dry-run-results
            • dry-run
            • delete
            • update
            • create
            • list
            • get
          • list
          • get
          • list-access-bindings
          • remove-access-binding
          • add-access-binding
          • set-access-bindings
      • iot
        • Overview
        • mqtt
          • Overview
          • subscribe
          • publish
        • registry
          • Overview
          • password
            • Overview
            • delete
            • add
            • list
          • certificate
            • Overview
            • add
            • delete
            • list
          • list-device-topic-aliases
          • delete
          • remove-labels
          • add-labels
          • logs
          • update
          • create
          • list
          • get
        • device
          • Overview
          • certificate
            • Overview
            • delete
            • add
            • list
          • password
            • Overview
            • delete
            • add
            • list
          • update
          • create
          • list
          • get
          • delete
          • remove-topic-aliases
          • add-topic-aliases
          • logs
      • serverless
        • Overview
        • api-gateway
          • Overview
          • remove-access-binding
          • add-access-binding
          • set-access-bindings
          • list-access-bindings
          • list-operations
          • delete
          • update
          • create
          • get-spec
          • list
          • get
        • trigger
          • Overview
          • create
            • Overview
            • timer
            • message-queue
            • cloud-logs
            • container-registry
            • object-storage
            • internet-of-things
          • add-labels
          • update
          • list
          • get
          • list-operations
          • resume
          • pause
          • delete
          • remove-labels
        • function
          • Overview
          • version
            • Overview
            • get
            • list
            • logs
            • get-by-tag
            • remove-tag
            • set-tag
            • create
          • runtime
            • Overview
            • list
          • list-access-bindings
          • invoke
          • logs
          • list-operations
          • delete
          • remove-labels
          • add-labels
          • update
          • create
          • list
          • get
          • tag-history
          • set-access-bindings
          • add-access-binding
          • remove-access-binding
          • allow-unauthenticated-invoke
          • deny-unauthenticated-invoke
      • logs
  1. Concepts
  2. Synchronous and asynchronous command execution modes

Synchronous and asynchronous command execution modes

  • Examples
    • Command execution in synchronous mode
    • Command execution in asynchronous mode

The CLI provides two command execution modes: synchronous and asynchronous.

By default, all commands are executed in synchronous mode. After you run a command in this mode, the CLI waits for the corresponding operation to be completed in Yandex.Cloud. If the command takes a long time to execute, dots are displayed indicating the execution process.

Commands that run for a long time are more convenient to execute in asynchronous mode. After running a command in this mode, the CLI immediately outputs information about the corresponding operation in Yandex.Cloud and allows the user to continue working. To use this mode, run a command with the --async flag. In response to this call, the CLI returns the operation ID, which is then used for getting information about the operation.

To get information about an operation run asynchronously, use the following commands:

  • Find out the current operation status:

    $ yc operation get <operation ID>
    
    • If the operation is still in progress, the information about the operation is displayed again.
    • If the operation is completed, you'll see the result of the operation.
  • To return to synchronous mode of operation execution:

    $ yc operation wait <operation ID>
    

Examples

Compare the execution of the create VM command in different modes.

Command execution in synchronous mode

First, dots are displayed indicating that the operation is in progress and then the result of the operation is output.

$ yc compute instance create --name my-inst3 --metadata user-data="#ps1\nnet user Administrator Passw0rd" --zone ru-central1-b --public-ip --create-boot-disk image-folder-id=standard-images,image-name=windows-2016-gvlk-1537967224
....................................................................................................................................................................done
id: epdplofgadqohn5ppkt3
folder_id: b1g88tflru0ek1omtsu0
created_at: "2019-01-23T14:18:21Z"
name: my-inst3
zone_id: ru-central1-b
platform_id: standard-v1
resources:
  memory: "2147483648"
  cores: "1"
  core_fraction: "100"
status: RUNNING
boot_disk:
  mode: READ_WRITE
  device_name: epdb30lg3sidrc65hbg1
  auto_delete: true
  disk_id: epdb30lg3sidrc65hbg1
network_interfaces:
- index: "0"
  mac_address: d0:0d:19:ae:1f:05
  subnet_id: e2lj2pco4kg851gsv3n2
  primary_v4_address:
    address: 10.0.0.11
    one_to_one_nat:
      address: 84.201.142.79
      ip_version: IPV4
fqdn: epdplofgadqohn5ppkt3.auto.internal

Command execution in asynchronous mode

Once the command has been run, information about the operation is output, and the execution continues in the background.

$ yc compute instance create --name my-test-inst --metadata user-data="#ps1\nnet user Administrator Passw0rd" --zone ru-central1-b --public-ip --create-boot-disk image-folder-id=standard-images,image-name=windows-2016-gvlk
-1537967224 --async
id: epdjte17at0fguj52ili
description: Create instance
created_at: "2019-02-13T08:49:25Z"
created_by: ajed79hm85fu3g6g5uej
modified_at: "2019-02-13T08:49:25Z"
metadata:
  '@type': type.googleapis.com/yandex.cloud.compute.v1.CreateInstanceMetadata
  instance_id: epdil0po4toutfhjrk0g
Language / Region
Careers
Privacy policy
Terms of use
Brandbook
© 2021 Yandex.Cloud LLC