k6 Cloud commands support a configurable default stack
Introduced 2026-02-10 · score 0.97
HOW TO USE IT
When running a Grafana Cloud test, log in with a stack to save it as the default, or set a stack for that run with `K6_CLOUD_STACK_ID` or `options.cloud.stackID`.
k6 cloud logink6 cloud login --token <YOUR_API_TOKEN> --stack <YOUR_STACK_URL_OR_SLUG>K6_CLOUD_STACK_ID=<YOUR_STACK_ID> k6 cloud run <SCRIPT.js>WHY THIS HELPS
Run a test in Grafana Cloud using the configured default stack or a stack selected for that run.
BEFORE THIS CHANGE
Users had to specify the project ID for every test run.
REQUIREMENTS AND LIMITATIONS
- Version: v1.6.0
- --token <YOUR_API_TOKEN>: API token for authentication; used with `--stack` for non-interactive login.
- --stack <YOUR_STACK_URL_OR_SLUG>: Stack URL or slug where cloud commands run by default.
- K6_CLOUD_STACK_ID=<YOUR_STACK_ID>: Environment variable selecting the stack by ID for cloud commands.
- options.cloud.stackID: Stack ID selected for the run; available in k6 v1.6.0 and later.
- options.cloud.projectID: Project ID for the cloud run.
- Prerequisite: Authenticate with a Grafana Cloud k6 API token and configure a stack to run cloud commands.
- A stack slug or stack id is used to determine which default project to use when one is not explicitly provided.
- If `projectID` does not belong to the configured stack, the run throws an error.
- Stack information will become mandatory to run a test in k6 v2.
- Docs conflict: Current k6 documentation says every cloud subcommand requires a configured stack; current release notes state stack is mandatory in k6 v2. The official v1.6.0 source documents stackID and projectID fields, but current documentation may describe newer behavior.
FIRST-PARTY EVIDENCE
- https://github.com/grafana/k6/releases/tag/v1.6.0
- https://grafana.com/docs/k6/latest/reference/cloud-commands/
- https://grafana.com/docs/grafana-cloud/observe-and-act/testing/k6/author-run/tokens-and-cli-authentication/?mdm=referral&plcmt=footer&src=joyk.com
- https://github.com/grafana/k6/blob/v1.6.0/cloudapi/config.go
Check the installed version and the source before using it. Entry JSON