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
    • Managing dependencies
    • Request handler
    • Invocation context
    • Logging
    • Handling errors
    • Using the SDK
  • Tools
  • Pricing policy
  • Access management
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • 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 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 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
Yandex project
© 2025 Yandex.Cloud LLC