Skip to content

CreateWorkspaceServiceAccountToken

Source: src/AWS/Grafana/CreateWorkspaceServiceAccountToken.ts

Runtime binding for the CreateWorkspaceServiceAccountToken operation (IAM action grafana:CreateWorkspaceServiceAccountToken), scoped to one Workspace.

Mints a short-lived API token for a Grafana service account. The token key is returned exactly once, as a Redacted value — use it as a Bearer token against the workspace’s Grafana HTTP API. Ideal for token rotation from a scheduled Lambda. Provide the implementation with Effect.provide(AWS.Grafana.CreateWorkspaceServiceAccountTokenHttp).

const createToken =
yield* Grafana.CreateWorkspaceServiceAccountToken(workspace);
const { serviceAccountToken } = yield* createToken({
name: "rotation-2026-07",
serviceAccountId: account.id,
timeToLive: "1 hour",
});
const key = Redacted.value(serviceAccountToken.key); // "glsa_..."