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.
Yandex Object Storage
    • All tutorials
    • Getting statistics on object queries with S3 Select
    • Getting website traffic statistics with S3 Select
    • Getting statistics on object queries using Yandex Query
    • Generating a resource-by-resource cost breakdown report using S3 Select
    • Server-side encryption
    • Integrating an L7 load balancer with CDN and Object Storage
    • Blue-green and canary deployment of service versions
    • Analyzing logs in DataLens
    • Mounting buckets to the file system of Yandex Data Processing hosts
    • Using Object Storage in Yandex Data Processing
    • Importing data from Object Storage, processing and exporting to Managed Service for ClickHouse®
    • Mounting a bucket as a disk in Windows
    • Migrating data from Yandex Data Streams using Yandex Data Transfer
    • Using hybrid storage in Yandex Managed Service for ClickHouse®
    • Loading data from Yandex Managed Service for OpenSearch to Yandex Object Storage using Yandex Data Transfer
    • Automatically copying objects from one bucket to another
    • Recognizing audio files in a bucket on a regular basis
    • Training a model in Yandex DataSphere on data from Object Storage
    • Connecting to Object Storage from VPC
    • Migrating data to Yandex Managed Service for PostgreSQL using Yandex Data Transfer
    • Uploading data to Yandex Managed Service for Greenplum® using Yandex Data Transfer
    • Uploading data to Yandex Managed Service for ClickHouse® using Yandex Data Transfer
    • Uploading data to Yandex Managed Service for YDB using Yandex Data Transfer
    • Exchanging data between Yandex Managed Service for ClickHouse® and Yandex Data Processing
    • Uploading data from Yandex Managed Service for YDB using Yandex Data Transfer
    • Hosting a static Gatsby website in Object Storage
    • Migrating a database from Managed Service for PostgreSQL to Object Storage
    • Exchanging data between Yandex Managed Service for ClickHouse® and Yandex Data Processing
    • Importing data from Yandex Managed Service for PostgreSQL to Yandex Data Processing using Sqoop
    • Importing data from Yandex Managed Service for MySQL® to Yandex Data Processing using Sqoop
    • Migrating data from Yandex Object Storage to Yandex Managed Service for MySQL® using Yandex Data Transfer
    • Migrating a database from Yandex Managed Service for MySQL® to Yandex Object Storage
    • Exporting Greenplum® data to a cold storage in Yandex Object Storage
    • Loading data from Yandex Direct to a Yandex Managed Service for ClickHouse® data mart using Yandex Cloud Functions, Yandex Object Storage, and Yandex Data Transfer
    • Migrating data from Elasticsearch to Yandex Managed Service for OpenSearch
    • Uploading Terraform states to Object Storage
    • Locking Terraform states using Managed Service for YDB
    • Visualizing Yandex Query data
    • Publishing game updates
    • VM backups using Hystax Acura
    • Backing up to Object Storage with CloudBerry Desktop Backup
    • Backing up to Object Storage with Duplicati
    • Backing up to Object Storage with Bacula
    • Backing up to Yandex Object Storage with Veeam Backup
    • Backing up to Object Storage with Veritas Backup Exec
    • Managed Service for Kubernetes cluster backups in Object Storage
    • Developing a custom integration in API Gateway
    • URL shortener
    • Storing application runtime logs
    • Developing a skill for Alice and a website with authorization
    • Creating an interactive serverless application using WebSocket
    • Deploying a web application using the Java Servlet API
    • Developing a Telegram bot
    • Replicating logs to Object Storage using Fluent Bit
    • Replicating logs to Object Storage using Data Streams
    • Uploading audit logs to ArcSight SIEM
    • Exporting audit logs to SIEM Splunk systems
    • Creating an MLFlow server for logging experiments and artifacts
    • Operations with data using Yandex Query
    • Federated data queries using Query
    • Recognizing text in image archives using Vision OCR
    • Converting a video to a GIF in Python
    • Automating tasks using Managed Service for Apache Airflow™
    • Processing files with usage details in Yandex Cloud Billing
    • Deploying a web app with JWT authorization in API Gateway and authentication in Firebase
    • Searching for Yandex Cloud events in Yandex Query
    • Searching for Yandex Cloud events in Object Storage
    • Creating an external table from a bucket table using a configuration file
    • Migrating databases from Google BigQuery to Managed Service for ClickHouse®
  • Terraform reference
  • Monitoring metrics
  • Audit Trails events
  • Bucket logs
  • Release notes
  • FAQ

In this article:

  • Get your cloud ready
  • Required paid resources
  • Set up your environment
  • Create an Object Storage bucket
  • Get the expense details
  • Generate a report
  • How to delete the resources you created
  1. Tutorials
  2. Generating a resource-by-resource cost breakdown report using S3 Select

Cost analysis by resource

Written by
Yandex Cloud
Updated at May 7, 2025
  • Get your cloud ready
    • Required paid resources
    • Set up your environment
  • Create an Object Storage bucket
  • Get the expense details
  • Generate a report
  • How to delete the resources you created

Configure the automatic export of expense details for your billing account and generate a report with info on the costs associated with the resources within a folder. To get data from the Object Storage bucket, we will be using the S3 Select query language.

To analyze the costs:

  1. Get your cloud ready.
  2. Create an Object Storage bucket.
  3. Get the expense details.
  4. Generate a report.

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 cost of analyzing expense details includes fees for bucket data storage and data operations (see Object Storage pricing).

Set up your environmentSet up your environment

Install and configure the AWS CLI.

Create an Object Storage bucketCreate an Object Storage bucket

Management console
  1. In the management console, select the folder where you want to create a bucket.
  2. From the list of services, select Object Storage.
  3. At the top right, click Create bucket.
  4. In the ** Name** field, enter a name for the bucket.
  5. Click Create bucket.

Get the expense detailsGet the expense details

Management console
  1. Go to Yandex Cloud Billing.

  2. Select the billing account you need from the list.

  3. Navigate to the Usage details tab.

  4. At the top right, click Export details and select Periodic export.

  5. In the window that opens:

    • In the Bucket field, enter the name of the bucket you created earlier. This bucket will store a CSV file with your expense details.
    • In the Directory field, enter the directory name for the file. It must end with the / character.
    • In the Language field, select the language to display product names in: English or Русский.
    • In the Usage details field, select *Resource.
  6. Click Create.

Generate a reportGenerate a report

Bash
  1. Run the query against Object Storage and save the output to a file:

    1. For convenience, save:

      • Name of the details bucket to a variable named $bucket:

        bucket=<bucket_name>
        
      • Key of the details object to a variable named $key:

        key=<object_key>
        
      • Expression to request data from the details file, to the $query variable:

        query="select service_name,resource_id,sku_id,sku_name,\"date\",cost from S3Object where service_name='Compute Cloud'"
        
    2. Run this command:

      aws --endpoint https://storage.yandexcloud.net s3api select-object-content \
        --bucket $bucket \
        --key $key \
        --expression "$query" \
        --expression-type 'SQL' \
        --input-serialization 'CSV={FileHeaderInfo=USE,FieldDelimiter=,}' \
        --output-serialization 'CSV={}' \
        "output.csv"
      
  2. To output the total cost for each resource, run an aggregation query using awk:

    < output.csv awk -F, '{n[$2]+=$6} END{for(i in n){print n[i] "\t" i}}' | sort -nrk1
    

    Result:

    591.206 c8rska9493**********
    254.092 c8rk36jv5n**********
    93.4481 a7l9vsb1bt**********
    ...
    0.742366 fdv0u8gkl**********
    0.694901 c8rhi3km7**********
    0.545707 a7l7fb0at**********
    

How to delete the resources you createdHow to delete the resources you created

To shut down the resources you created and stop paying for them:

  1. Delete all objects from the bucket.
  2. Delete the bucket.

Was the article helpful?

Previous
Getting statistics on object queries using Yandex Query
Next
Server-side encryption
© 2025 Direct Cursus Technology L.L.C.