Replace K6 cloud with local database

Hi Team,
Is it possible to replace K6 cloud with K6 local execution ? For example, “K6 login cloud” command will ask your email id and password as an input and validate it. After successful validation, the test will be executed in K6 cloud and the result is stored in K6 cloud.

Now, I have a database where I store email id and password. Is it possible to run “K6 login” command against my database (something like k6 login mydatabase) ?

Thanks in advance.

Hi @satheeshpandianj

I’m afraid not, k6 login is not meant to be used in such a way. If your credentials to k6 Cloud are stored in the database, then I think it’s better to write a script that would extract them from DB and pass them to k6 login command :slightly_smiling_face: Alternatively, you can run k6 login with API token:

$ k6 login cloud --token <YOUR_K6_CLOUD_API_TOKEN>

API token can be copied at k6 app page

Thanks @olha. From your answer, my understanding is that ‘k6 login’ command only works for cloud, NOT for k6 local execution. Is that right?

More precisely k6 login can be used with k6 Cloud and with InfluxDB. It can be seen in the help of command like this:

$ k6 login
Usage:
  k6 login [flags]
  k6 login [command]

Available Commands:
  cloud       Authenticate with Load Impact
  influxdb    Authenticate with InfluxDB

...

But InfluxDB here means using it as an output, with -o option, not to look up any data in it. I got an impression that you wanted to use username and password from your DB to authenticate against our Cloud? If so, then no, it is not in scope of k6 login. And local execution with k6 run doesn’t require any authentication to anything at all.

OTOH, if you need an output separate from Cloud, then this doc might be helpful: Results output

Thank you @olha for your quick answer.