Cloud execution context variables
When you run a cloud test, you can use three additional environment variables to find out in which load zone, server instance, and distribution label the script is currently running.
You can read the values of these variables in your k6 script as usual.
export const options = {
vus: 50,
duration: '30s',
cloud: {
distribution: {
ashburnDistribution: { loadZone: 'amazon:us:ashburn', percent: 50 },
dublinDistribution: { loadZone: 'amazon:ie:dublin', percent: 50 },
},
},
};
export default function () {
if (__ENV.K6_CLOUDRUN_DISTRIBUTION === 'ashburnDistribution') {
// do something
} else if (__ENV.K6_CLOUDRUN_DISTRIBUTION == 'dublinDistribution') {
// do something
}
}