Skip to content

yandex-cloud/nodejs-sdk

Repository files navigation

Yandex.Cloud SDK (nodejs)

npm License

Need to automate your infrastructure or use services provided by Yandex.Cloud? We've got you covered.

Requirements

  • nodejs >= 22.15

Installation

npm install @yandex-cloud/nodejs-sdk

Getting started

There are three options for authorization your requests:

Metadata Service

Don't forget to assign Service Account for your Instance or Function.

import { Session} from '@yandex-cloud/nodejs-sdk';
import { cloudService } from '@yandex-cloud/nodejs-sdk/resourcemanager-v1';

// Initialize SDK with your token
const session = new Session();

// Create service client
const cloudServiceClient = session.client(cloudService.CloudServiceClient);

// Issue request (returns Promise)
const response = await cloudServiceClient.list(cloudService.ListCloudsRequest.fromPartial({
    pageSize: 100,
}));

IAM Token

import { Session } from '@yandex-cloud/nodejs-sdk';
import { cloudService } from '@yandex-cloud/nodejs-sdk/resourcemanager-v1';

// Initialize SDK with your token
const session = new Session({ iamToken: 'YOUR_TOKEN' });

// Create service client
const cloudServiceClient = session.client(cloudService.CloudServiceClient);

// Issue request (returns Promise)
const response = await cloudServiceClient.list(cloudService.ListCloudsRequest.fromPartial({
    pageSize: 100,
}));

Check examples directory for more examples.

To run example scripts, you should execute the following commands:

cd examples
npm i
YC_IAM_TOKEN=... YC_FOLDER_ID=... npm run start path/to/example.ts

P.S If you need generated client for other Yandex.Cloud services, just open an issue.

About

Yandex.Cloud NodeJS SDK

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors