How to send AWS API request in K6 [Aws Signature]

Hello Guys, I have Simple Get API using AWS Signature in K6.
But I could not imagine how to call using it K6. I will send K6 Script so far I have done. please help me to achieve this. Thank you.

Here is my code

// JavaScript source code 
import http from 'k6/http';
import { AWSConfig, S3Client  } from '';

const awsConfig = new AWSConfig({
  region: 'ap-south-1',
  accessKeyId: 'someaccesskeyid',

const s3 = new S3Client(awsConfig);

export let options = {
    stages: [
        { duration: '1s', target: 1 },  //ramp-up from 1 to 10 users over 5 mins.
        { duration: '1s', target: 1 },  //stay at 10 users for 10 mins
        { duration: '1s', target: 0 },    // ramp-down to 0 users over 5 mins
    thresholds: {
      http_req_duration: ['p(99)<1500'], // 99% of requests must complete below 1.5s
export default function () {
  let response1 = http.get("somes3url",s3);

Hi @Dhanuka123

I’ve edited your post for your own safety. Regardless of whether the tokens you posted were valid or if they were for a sandbox, I would recommend to never post real credentials in a public place. Both for your sake, and to maintain best practices among the k6 open-source’s community :bowing_man:.

I’m not entirely sure that I understand what you’re trying to achieve here, but from the example code you’ve posted, it seems you import our AWS SDK, but do not really make use of it.

Could you please clarify what is it that you’re trying to test specifically, and what operations would you need to perform in order to test them? That way I’ll have more data points to support you :+1:

Thank you!

Hello sir, Simply I want to make this simple GET API call through K6. in postman it is working with given credentials, but in K6 it is not working, I want to know how and where I should put " region", “accessKeyId” and “secretAccessKey” in source code.
My get API with parameters is

     let response1 = http.get("");

My understanding is that you’re trying to make a request to an Amazon AWS service called the Execute API. This call is a GET call. I found this documentation which indicates that the URL you’ve produced looks similar to what they describe.

I’m not too familiar with this part of AWS, but my understanding after quickly going through their docs is that your request should work if the endpoint you are targeting is “anonymous”. Is that the case?

If it is not, the documentation indicates that the request needs to be signed. However, although the code you posted imports the S3 SDK and sets up an AWSConfig, that won’t actually sign your request to Execute API, which is another service than S3.

Our AWS jslib does not support the “Execute API” just yet but feel free to open a GitHub issue requesting the implementation of the subset you need, or even better, give a shot at contributing an implementation yourself (here is an example of a user who did just that). That would be much appreciated :bowing_man:

But when I called this API through k6, I got a 403 forbidden error. I can not imagine why.

The HTTP 403 Forbidden code indicates your request is probably not authenticated. Hence, in my previous comment, you’re trying to shoot a request to an AWS service that expects a signed request, and it is not.