Yandex Cloud
Search
Contact UsGet started
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML Services
    • Business tools
  • 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
  • Pricing
  • Customer Stories
  • Documentation
  • Blog
© 2025 Direct Cursus Technology L.L.C.
Yandex Cloud Functions
  • Comparison with other Yandex Cloud services
    • Overview
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Public materials
  • Release notes
  • FAQ

In this article:

  • Using the invocation context
  • Authentication in the Yandex Cloud API
  1. Developing in Python
  2. Invocation context

Python function invocation context

Written by
Yandex Cloud
Updated at July 27, 2022
  • Using the invocation context
    • Authentication in the Yandex Cloud API

Invocation context is an object that contains certain execution context parameters as well as invocation parameters for the Python function itself. It is accepted by the call handler as its second argument.

The invocation context contains:

  • function_name: Function ID.
  • function_version: Function version ID.
  • memory_limit_in_mb: Amount of memory specified at version creation, MB.
  • request_id: ID of the request being handled.
  • token: Yandex Cloud API authentication parameters.

The context also contains the following helper methods:

  • get_remaining_time_in_millis(): Returns the current request's remaining runtime in milliseconds.

Invocation context example.

Using the invocation contextUsing the invocation context

Invocation context is required for a function to have access to environment information so that it can monitor memory usage, track request execution time, and authenticate in the Yandex Cloud service API.

Authentication in the Yandex Cloud APIAuthentication in the Yandex Cloud API

If a function has a service account specified, the token parameter contains information for authentication on behalf of this service account:

  • access_token: IAM token.
  • expires_in: Token lifetime in seconds.
  • token_type: Token type (Bearer).

You can also get this information using the metadata service. For more information, see Authentication from within a VM.

Was the article helpful?

Previous
Request handler
Next
Logging
© 2025 Direct Cursus Technology L.L.C.