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
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Tutorials
    • All tutorials
    • URL shortener
    • Entering data into storage systems
    • Storing application runtime logs
    • Deploying a web application using the Java Servlet API
    • Developing a Slack bot
    • Developing a Telegram bot
    • Developing a custom integration in API Gateway
    • Developing CRUD APIs for movie services
    • Building a CI/CD pipeline in GitLab
    • Working with an API gateway via WebSocket
    • Creating an interactive serverless application using WebSocket
    • Automatically copying objects from one Object Storage bucket to another
    • Visualizing logs in Grafana using the Cloud Logging plugin
    • Canary release of a Cloud Functions function
    • Interactive debugging of Cloud Functions functions
    • Creating a Node.js function using TypeScript
    • Running a containerized app in Serverless Containers
    • Streaming Yandex Cloud Postbox events to Data Streams and analyzing them using DataLens
    • Using API Gateway to set up speech synthesis in SpeechKit
    • Connecting to YDB from a Cloud Functions function in Python
    • Connecting to a YDB database from a Cloud Functions function in Node.js
    • API Gateway protection with Smart Web Security
    • Deploying a web app with JWT authorization in API Gateway and authentication in Firebase
    • Automatic data upload to Yandex SpeechSense using Yandex Workflows
    • Configuring responses in Cloud Logging and Yandex Cloud Functions
    • Setting up Workflows integration with Tracker, YandexGPT, and Yandex Cloud Postbox
    • Developing functions in Functions Framework and deploying them to Yandex Serverless Containers
      • Overview
      • Management console
      • Terraform

In this article:

  • Get your cloud ready
  • Required paid resources
  • Set up your infrastructure
  • Create a service account
  • Create an Object Storage bucket
  • Assign access permissions for the bucket to the service account
  • Create a static key for the service account
  • Create a Yandex Lockbox secret for the static key
  • Create and configure a Cloud Functions function
  • Create and set up a Forms form
  • Create an API key
  • Create a form
  • Set up integration with a Cloud Functions function
  • Test the integration you created
  • Configure a connection and binding to data in Query
  • Set up fetching data in DataLens
  • Test the new resource integration
  • Delete the resources you created
  1. Serverless technologies
  2. Migrating data from Yandex Forms to Yandex DataLens using Yandex Cloud Functions and Yandex Query
  3. Management console

Delivering data from Yandex Forms to Yandex DataLens using Yandex Cloud Functions and Yandex Query via the management console

Written by
Yandex Cloud
Updated at May 7, 2025
  • Get your cloud ready
    • Required paid resources
  • Set up your infrastructure
    • Create a service account
    • Create an Object Storage bucket
    • Assign access permissions for the bucket to the service account
    • Create a static key for the service account
    • Create a Yandex Lockbox secret for the static key
  • Create and configure a Cloud Functions function
  • Create and set up a Forms form
    • Create an API key
    • Create a form
    • Set up integration with a Cloud Functions function
    • Test the integration you created
  • Configure a connection and binding to data in Query
  • Set up fetching data in DataLens
  • Test the new resource integration
  • Delete the resources you created

To set up integration of Forms and DataLens via the management console, follow these steps:

  1. Set up your infrastructure.
  2. Create a Yandex Cloud Functions function.
  3. Create a form in Forms.
  4. Configure a connection and binding to data in Yandex Query.
  5. Set up fetching data in DataLens.
  6. Test the new resource integration.

If you no longer need the resources you created, delete them.

Get your cloud readyGet your cloud ready

Sign up in Yandex Cloud and create a billing account:

  1. Navigate to the management console and log in to Yandex Cloud or register a new account.
  2. On the Yandex Cloud Billing page, make sure you have a billing account linked and it has the ACTIVE or TRIAL_ACTIVE status. If you do not have a billing account, create one and link a cloud to it.

If you have an active billing account, you can navigate to the cloud page to create or select a folder for your infrastructure to operate in.

Learn more about clouds and folders.

Required paid resourcesRequired paid resources

The infrastructure support cost includes:

  • Fee for using the Yandex Object Storage bucket (see Object Storage pricing).
  • Fee for storing and requesting Yandex Lockbox secrets (see Yandex Lockbox pricing).
  • Fee for function calls and computing resources allocated for executing the functions (see Cloud Functions pricing).
  • Fee for the amount of data read from sources when executing Query queries (see Query pricing).
  • Fee for using DataLens under the service plan (see DataLens pricing).

Set up your infrastructureSet up your infrastructure

Create a service accountCreate a service account

Management console
  1. In the management console, select the appropriate folder.
  2. From the list of services, select Identity and Access Management.
  3. Click Create service account.
  4. Enter a name for the service account: forms-integration-sa.
  5. Click Add role and select the following roles.
    • lockbox.payloadViewer: For reading Yandex Lockbox secrets.
    • functions.functionInvoker: For invoking the Cloud Functions function.
    • storage.editor: For reading data from, and writing data to, an Object Storage bucket.
    • yq.viewer and yq.invoker: For integrating DataLens and Query.
  6. Click Create.

Create an Object Storage bucketCreate an Object Storage bucket

The Object Storage bucket will store data from Forms.

Management console
  1. In the management console, select the appropriate folder.
  2. From the list of services, select Object Storage.
  3. Click Create bucket.
  4. Enter the bucket ** Name**.
  5. Click Create bucket.

Assign access permissions for the bucket to the service accountAssign access permissions for the bucket to the service account

Management console
  1. In the management console, select the appropriate folder.

  2. From the list of services, select Object Storage.

  3. Open the bucket you created earlier.

  4. Go to Objects.

  5. Click and select Configure ACL.

  6. In the ACL editing window that opens:

    1. Start typing the service account name, forms-integration, and select it from the drop-down list.
    2. Select the READ and WRITE access permissions.
    3. Click Add.
    4. Click Save.

Create a static key for the service accountCreate a static key for the service account

Management console
  1. In the management console, select the appropriate folder.
  2. From the list of services, select Identity and Access Management.
  3. Select the forms-integration service account.
  4. Go to Overview.
  5. Click Create new key and select Create static access key.
  6. Click Create.
  7. In the window that opens, New key, you will see Key ID and Your secret key. Save them, as you will need them later.

Create a Yandex Lockbox secret for the static keyCreate a Yandex Lockbox secret for the static key

Management console
  1. In the management console, select the appropriate folder.
  2. From the list of services, select Lockbox.
  3. Click Create secret.
  4. Enter the secret's Name: static-key.
  5. Under Secret data:
    1. Select Secret type: Custom.
    2. Create the following key-value pairs:
      • Static key ID:

        • Key: static-key-id.
        • Value: Select Text and enter the ID of the static key you created earlier.
      • Static key value:

        • Key: static-key-value.
        • Value: Select Text and enter the value of the static key you created earlier.

Create and configure a Cloud Functions functionCreate and configure a Cloud Functions function

Management console
  1. In the management console, select the appropriate folder.

  2. From the list of services, select Cloud Functions.

  3. Create a function:

    1. Click Create function in the top-right corner.
    2. Enter the function Name: forms-function.
    3. Click Create.
  4. Create a function version:

    1. In the Editor window that opens, select the runtime environment: Python.

    2. Disable the Add files with code examples option.

    3. Click Continue.

    4. Select the function creation Method: Code editor.

    5. In the function editor window, click Create file.

    6. In the window that opens, enter the file Name: forms-integration.py. Click Create.

    7. Paste the function code to the forms-integration.py file:

      import boto3
      import os
      import json
      from botocore.config import Config
      
      def get_answers(raw_answers: json) -> json:
          result = {}
          for name, value in raw_answers.get('answer').get('data').items():
              if name.startswith('answer_choices_'):
                  choices = []
                  for c in value.get('value'):
                      choices.append(c.get('text'))
                  result[name] = ','.join(choices)
              else:
                  result[name] = value.get('value')
          return result
      
      def handler(event, context):
          headers = event.get('headers')
          form_id = headers.get('X-Form-Id')
          answer_id = headers.get('X-Form-Answer-Id')
      
          body_json = json.loads(event.get('body'))
          answers_json = get_answers(body_json)
      
          aws_access_key_id = os.environ['KEY']
          aws_secret_access_key = os.environ['SECRET_KEY']
          bucket_name = os.environ['BUCKET']
      
          s3 = boto3.client(service_name='s3',
                            aws_access_key_id=aws_access_key_id,aws_secret_access_key=aws_secret_access_key,
                            endpoint_url='https://storage.yandexcloud.net', region_name='ru-central1',
                            config=Config(request_checksum_calculation="when_required"))
      
          s3.put_object(Bucket=bucket_name, Key=f"{form_id}/{answer_id}.json", Body=json.dumps(answers_json))
      
          return {
              'statusCode': 200,
              'body': "OK",
              'headers': {
                  'Content-Type': 'text/plain',
              }
          }
      
      
    8. In the function editor window, click Create file.

    9. In the window that opens, enter the file Name: requirements.txt. Click Create.

    10. In requirements.txt, specify the boto3 library for accessing Object Storage from your function:

      boto3
      
    11. In the Entry point field, specify forms-integration.handler.

    12. In the Service account field, select the previously created account named forms-integration-sa.

    13. Under Environment variables, create a variable containing the bucket name where the function results will be stored:

      1. Key: BUCKET.
      2. Value: Name of the bucket you created earlier.
    14. Under Lockbox secrets:

      1. Create a KEY variable for the static key ID. Set the parameters as follows:

        • Environment variable: KEY.
        • Secret ID: Select the static-key-id secret.
        • Version ID: Select the version marked latest.
        • Secret key: Select static-key-id.
      2. Create a SECRET_KEY variable for the static key ID. Set the parameters as follows:

        • Environment variable: SECRET_KEY.
        • Secret ID: Select the static-key-value secret.
        • Version ID: Select the version marked latest.
        • Secret key: Select static-key-value.
    15. Once your function is created, on the Overview tab, enable Public function:

Create and set up a Forms formCreate and set up a Forms form

Create an API keyCreate an API key

You need an API key to set up integration with Forms.

Management console
  1. In the management console, select the appropriate folder.
  2. From the list of services, select Identity and Access Management.
  3. Select the forms-integration service account.
  4. Go to Overview.
  5. Click Create new key and select Create API key.
  6. Click Create.
  7. In the window that opens, New key, you will see Key ID and Your secret key. Save them, as you will need them later.

Create a formCreate a form

Forms interface
  1. Go to Forms.

  2. Click Create form.

  3. Add at least two fields to the form and set up any questions in them.

  4. Click Publish.

  5. Save the link to the published form: you will need it later.

Set up integration with a Cloud Functions functionSet up integration with a Cloud Functions function

Forms interface
  1. Go to Forms.

  2. Open the form you created earlier.

  3. Go to the Settings tab.

  4. Open the Additional section.

  5. Under Cloud function key, enter the data of the previously created API key and click Save.

  6. Open the Integrations tab.

  7. Click Cloud Functions to add a condition for the integration.

  8. In the Function code field, enter the Cloud Functions function ID. You can copy the ID in the Overview section of the Cloud Functions function in the management console.

  9. In the Show outcome notification field, select Show.

  10. Click Save.

Test the integration you createdTest the integration you created

  1. Follow the public link to the previously created form.

  2. Complete the form and click Submit.

  3. Go to Forms.

  4. Open the form you created earlier.

  5. Open the Integrations tab.

  6. Go to the Completed integrations page.

  7. Open the completed action record and make sure that the Response section contains the 200 — OK response.

  8. Navigate to the management console and open the bucket created earlier. Make sure the bucket now contains a JSON file with the data from the form you completed.

    The name of the directory the file will reside in matches the form's internal ID. Save this ID for the next steps.

    All the future form completion outcomes will be saved in this directory.

  9. Complete the form several times more, and make sure you fill one of the fields in the same way in at least two forms. This will improve data visualization when testing the integration.

Configure a connection and binding to data in QueryConfigure a connection and binding to data in Query

Query interface
  1. Navigate to the management console and select Query.
  2. In the Connections tab, click Create new.
  3. Create a connection with the following parameters:
    • Name: forms-connection.
    • Type: Object Storage.
    • Bucket: Name of the bucket you created earlier.
    • Service account: forms-integration-sa.
  4. In the window that opens, set the data binding parameters:
    • Type: Object Storage.
    • Connection: forms-connection.
    • Path: /<form_ID>/.
      You can copy the ID:
      • Under Objects in the Object Storage bucket. The name of the folder containing the file with results of the completed form matches the form ID.
      • In the address bar of the Forms interface, on the form viewing or editing page.
    • Format: json_each-row.
    • Columns: Create columns for the fields you specified in the form.
      If you want Query to define columns automatically, click Detect columns.

Set up fetching data in DataLensSet up fetching data in DataLens

DataLens interface
  1. Go to DataLens.
  2. In the left-hand panel, select Connections and click Create connection.
  3. Select Query. In the window that opens, set the below parameters as follows:
    • Cloud and folder: Select the cloud and folder where you created the rest of the resources.
    • Service account: forms-integration-sa
  4. Click Save changes. In the window that opens, specify forms-datalens-connection as the connection name, then click Create.
  5. Go back to the DataLens main page and click Create dataset.
  6. In the connection panel, click Add and select the forms-datalens-connection connection.
  7. Under Tables, select the table and drag it to your DataLens workspace.
    After loading, the data from the table will appear in the Preview panel.
  8. Click Save and enter forms-integration-dataset as the dataset name, then click Create.

Test the new resource integrationTest the new resource integration

To check how the created resources work together, open the forms-integration-dataset dataset and click Create chart. In the window that opens, create a chart using the data from the form. For better visualization, create a chart based on a field with repeating values.

Delete the resources you createdDelete the resources you created

Some resources are not free of charge. To avoid paying for them, delete the resources you no longer need:

  1. DataLens chart.
  2. DataLens dataset.
  3. DataLens connection.
  4. Query binding.
  5. Query connection.
  6. Cloud Functions function.
  7. Yandex Lockbox secret.
  8. Object Storage buckets.

Was the article helpful?

Previous
Overview
Next
Terraform
© 2025 Direct Cursus Technology L.L.C.