On this page, read about how to:
- Use the k6 cloud command to run tests on k6 Cloud infrastructure
- Use k6 run --out to run the test locally and stream results to k6 Cloud (perfect for testing local environments)
To run tests on k6 Cloud, you to need to:
- Have a k6 Cloud account. If you don't have one, sign up and get 50 cloud tests with the Free Trial.
- Install k6 on your local machine:
With the k6 cloud command, you can run tests on Cloud servers, with scripts on your local machine.
Authenticate to k6 Cloud from the CLI. To log in, either use your username and password or your API token.Log in with username and passwordLog in with the API Token
k6 login stores your API Token in a local config file to authenticate to k6 Cloud when running cloud commands. Unless running tests on multiple cloud accounts, you need to run k6 login only once.
Run your test in the cloud. (k6 cloud automatically uploads your script and any dependencies to our cloud).CLICLI with the API TokenDocker
k6 will print some information and the URL of your test results.
Navigate to the URL to check your test results. When the test is running, the test-result page is shown.
Learn more about test results at Analyzing Results.
At times, you might want to run a test locally, but see the results on k6 Cloud. For example, you may want to test a local environment that is not connected to the wider internet.
To do, this you can use k6 run --out cloud. For detailed instructions, refer to the real-time results output docs.
k6 charges your subscription for cloud streaming
Data storage and processing are primary cloud costs, so k6 run --out cloud will consume VUh or test runs from your subscription.
By default, k6 creates, runs, and stores tests and test runs in the default project to your default organization.
To create and run tests under a different project, set the Project ID in your script options.
- Select the project on the sidebar menu.
- Find the Project ID in the header of the Project Dashboard page.
You can pass the Project ID to k6 in two ways:
Specify it in the script options:script.js
Set the K6_CLOUD_PROJECT_ID environment variable when running your test.
If you have multiple cloud subscriptions, use your API token to change between subscriptions. One way to do this is with environment variables:
Another way is to toggle between config files with the --config flag.
For syntax examples and the default config locations, refer to the --config option reference.