Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
  • Blog
  • Pricing
  • Documentation
Yandex project
© 2025 Yandex.Cloud LLC
Yandex Cloud Functions
  • Comparison with other Yandex Cloud services
    • Overview
    • Function
    • Invoking a function
    • Asynchronous function invocation
    • Long-lived functions
    • Function termination notifications
    • Networking
    • Mounting external resources to a function file system
    • Builder
    • Dead Letter Queue
    • Function logs
    • Backups
    • Quotas and limits
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Release notes
  • FAQ

In this article:

  • Function versions
  • Code upload format
  • Version tag
  • Programming model
  • Model description
  • Scaling a function
  • Use cases
  1. Concepts
  2. Function

Function

Written by
Yandex Cloud
Improved by
amatol
Updated at April 24, 2025
  • Function versions
    • Code upload format
    • Version tag
  • Programming model
    • Model description
    • Scaling a function
  • Use cases

A function allows you to put your code in Yandex Cloud and run it on request or trigger.

Possible function statuses include:

  • Creating: Function was created; background initialization processes are running.
  • Active: Function was successfully created and is ready for use.
  • Deleting: Function and all associated resources are being deleted. The function still exists, but you can no longer use it.
  • Error: Error while creating the function. The function exists, but cannot be used.

Once created, a function only contains its own metadata, including its name, description, and unique ID. To start using the function, you need to create a function version. You can execute functions using the HTTPS API or CLI.

Before writing your functions, review the programming model.

Function versions

Versions contain the function code, run parameters, and all required dependencies. You can work with different versions of the same function during different development stages, e.g., under development, alpha version, beta version, etc. Each time a change is made, the system automatically creates a new version and tags it as $latest by default. It does not matter whether you uploaded a completely new code or only made some minor changes. You cannot delete a version with the $latest tag.

Possible function version statuses include:

  • Creating: Function version was created; background initialization processes are running.
  • Active: Function version was successfully created and is ready for use.
  • Obsolete: Function version is obsolete and about to be deleted as it had no tags for a long time. To make it Active again, add a tag.
  • Deleting: Function version is being deleted. It still exists, but you can no longer use it.

Code upload format

To create a version, you can use the code editor or upload your code and its dependencies in one of the formats described in the table below. After you create a function, you no longer need the object with the code. You can delete it from storage.

Format Management console Yandex Cloud CLI
ZIP archive from your PC
ZIP archive from S3, specifying the bucket and object
Directory
File

Warning

Files larger than 3.5 MB should be uploaded via Object Storage. For more information about limits, see Quotas and limits in Cloud Functions.

For more information about how to create versions, see Creating a function version.

Version tag

Tags are used for calling a particular version of a function. Each tag must be unique within the function. One version may have multiple tags.

Note

Once a new version is created, it gets the default tag: $latest. You cannot delete the $latest tag.

Programming model

Cloud Functions supports different programming languages. Regardless of the language you choose, you should write your code based on the programming model accepted in the service. It contains elements that the user needs to implement as well as mechanisms that are already implemented on the service side and can be used when necessary.

Model description

To enable a function call, describe a handler in it. It is defined when writing code. The handler handles the data received by invoking respective functions and methods in the code. The handler should accept the data that comes with function requests and the context provided by Cloud Functions. Some runtime environments have requirements for an absolute path to the handler file:

  • Python, Go, Java: No . in the file name before the extension, e.g., .handler.py.
  • .NET Core: No . in the file name before the extension and at the beginning of the name of the directory containing the handler file, e.g., .handler.cs or .test/handler.cs.

Context allows your function code to interact with Cloud Functions. For example, the function can use it to find how much time is left before Cloud Functions completes its execution.

Incoming requests are processed by the function one at a time. For your function to process multiple requests simultaneously, use asynchronous code execution provided by the runtime environment.

To report a function execution error to the service, handle errors using exceptions.

The service logs the execution of functions. However, if necessary, you can implement additional logging in your function code.

Scaling a function

A function instance processes one function call at a single point in time. If the function is called faster than the instance can process the request, the service scales the function by running additional instances of it. This ensures concurrent request processing. In Cloud Functions, you can specify:

  • zone_instances_limit: Number of function instances in the availability zone.
  • zone_requests_limit: Number of concurrent function calls in the availability zone.
  • provisioned_instances_count: Number of ready-to-go instances.
  • concurrency: Maximum number of calls processed concurrently by a single function instance. Available only in certain runtime environments. For more information, see Concurrent function instance calls.

Note

Calls are distributed across availability zones randomly. Cloud Functions does not guarantee the even distribution of calls across the zones. For example, all calls, no matter how many, might end up in the same zone.

Scaling settings take effect within five minutes after being configured.

Concurrent function instance calls

To allow a single function instance to handle multiple function calls concurrently, set the concurrency parameter when creating a function version. The IDs of such calls (RequestID) must be unique. Otherwise, you will be getting an error when attempting to process a call with a duplicate ID.

If at least one call reaches a timeout, that call and all other calls handled by the same function instance will be aborted. For more information about the timeout, see Limits.

The concurrency parameter is available for functions with the following runtime environments:

  • Node.js
  • Go
  • Java
  • Bash
  • Kotlin

Limits

When the number of function instances reaches the zone_instances_limit value, Cloud Functions stops scaling it. If there are more function calls than the instances can handle, the new call is queued and treated as a call in progress. When the number of calls in progress reaches the zone_requests_limit value, the service stops queuing calls and returns the 429 TooManyRequests error.

Provisioned instances

A provisioned instance is a function instance that, when started, is guaranteed not to have a cold start. In the provisioned instance before the function is called:

  • The interpreter is started.
  • Cloud Functions runtime environment components are initialized.
  • The user code is loaded and initialized.

Downtime of provisioned instances and runtime of the function in them are charged additionally.

If there are more function calls than provisioned instances can handle, Cloud Functions scales the function within the quotas. New calls can be handled by either a provisioned instance or a regular one, whichever becomes free or created first.

Provisioned instances count towards the following quotas even when they are not running:

  • Number of function instances per availability zone.
  • Total RAM for all running functions per availability zone.
  • Number of provisioned function instances per cloud.

Use cases

  • Developing a custom integration in API Gateway
  • Running computations in Yandex DataSphere using the API
  • Canary release of a Cloud Functions function
  • Streaming Yandex Cloud Postbox events to Yandex Data Streams and analyzing them using Yandex DataLens
  • Developing functions in Functions Framework and deploying them in Yandex Serverless Containers
  • Sensor reading monitoring and event notifications
  • Deploying a fault-tolerant architecture with preemptible VMs

See also

  • Creating a function version
  • Adding scaling settings

Was the article helpful?

Previous
Overview
Next
Invoking a function
Yandex project
© 2025 Yandex.Cloud LLC