This is a k6 extension using the xk6 system.
| ❗ This is a proof of concept, isn't supported by the k6 team or by the maintainer, and may break in the future. USE AT YOUR OWN RISK! |
|---|
To build a k6 binary with this extension, first ensure you have the prerequisites:
- Go toolchain
- Git
Then, install xk6 and build your custom k6 binary with the SQS extension:
- Install
xk6:
$ go install go.k6.io/xk6/cmd/xk6@latest- Build the binary:
$ xk6 build --with github.com/mridehalgh/xk6-sqs@latestThis plugin uses the AWS SDK Go v2 default credential chain. It looks for credentials in the following order:
- Environment variables.
- Static Credentials (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY,AWS_SESSION_TOKEN) - Web Identity Token (
AWS_WEB_IDENTITY_TOKEN_FILE)
- Static Credentials (
- Shared configuration files.
- SDK defaults to
credentialsfile under.awsfolder that is placed in the home folder on your computer. - SDK defaults to
configfile under.awsfolder that is placed in the home folder on your computer.
- SDK defaults to
- If your application uses an ECS task definition or RunTask API operation, IAM role for tasks.
- If your application is running on an Amazon EC2 instance, IAM role for Amazon EC2.
import sqs from 'k6/x/sqs';
const client = sqs.newClient()
export default function () {
const params = {
DelaySeconds: 0,
MessageAttributes: {
"Title": {
DataType: "String",
StringValue: "The Whistler"
},
"Author": {
DataType: "String",
StringValue: "John Grisham"
},
"WeeksOn": {
DataType: "Number",
StringValue: "6"
}
},
MessageBody: "Information about current NY Times fiction bestseller for week of 12/11/2016.",
// MessageDeduplicationId: "TheWhistler", // Required for FIFO queues
// MessageGroupId: "Group1", // Required for FIFO queues
QueueUrl: "QUEUE_URL"
};
sqs.send(client,params)
}