Skip to main content

Create

Creates an access key for the specified service account.

import { cloudApi, serviceClients, Session } from "@yandex-cloud/nodejs-sdk";

const CreateAccessKeyRequest =
cloudApi.iam.awscompatibility_access_key_service.CreateAccessKeyRequest;

(async () => {
const authToken = process.env["YC_OAUTH_TOKEN"];
const session = new Session({ oauthToken: authToken });
const client = session.client(serviceClients.AccessKeyServiceClient);

const result = await client.create(
CreateAccessKeyRequest.fromPartial({
// serviceAccountId: "serviceAccountId",
// description: "description"
})
);
console.log(result);
})();

CreateAccessKeyRequest​

serviceAccountId : string​

ID of the service account to create an access key for. To get the service account ID, use a yandex.cloud.iam.v1.ServiceAccountService.List request. If not specified, it defaults to the subject that made the request.

description : string​

Description of the access key.

CreateAccessKeyResponse​

accessKey : AccessKey​

AccessKey resource.

secret : string​

Secret access key. The key is AWS compatible.

AccessKey​

An access key. For more information, see AWS-compatible access keys.

id : string​

ID of the AccessKey resource. It is used to manage secret credentials: an access key ID and a secret access key.

serviceAccountId : string​

ID of the service account that the access key belongs to.

createdAt : google.protobuf.Timestamp​

Creation timestamp.

description : string​

Description of the access key. 0-256 characters long.

keyId : string​

ID of the access key. The key is AWS compatible.

lastUsedAt : google.protobuf.Timestamp​

Timestamp for the last authentication using this Access key.