---
title: "putEvents | Grafana k6 documentation"
description: "EventBridgeClient.putEvents sends custom events to Amazon EventBridge"
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# putEvents

`EventBridgeClient.putEvents` sends custom events to Amazon EventBridge so that they can be matched to rules.

### Parameters

Expand table

| Parameter | Type                              | Description                                              |
|-----------|-----------------------------------|----------------------------------------------------------|
| input     | [PutEventsInput](#puteventsinput) | An array of objects representing events to be submitted. |

#### PutEventsInput

Expand table

| Parameter  | Type                                     | Description                                              |
|------------|------------------------------------------|----------------------------------------------------------|
| Entries    | [EventBridgeEntry](#eventbridgeentry)\[] | An array of objects representing events to be submitted. |
| EndpointId | string (optional)                        | The ID of the target to receive the event.               |

#### EventBridgeEntry

Expand table

| Parameter    | Type                 | Description                                                                                                                                       |
|--------------|----------------------|---------------------------------------------------------------------------------------------------------------------------------------------------|
| Source       | string               | The source of the event.                                                                                                                          |
| Detail       | object               | A JSON object containing event data.                                                                                                              |
| DetailType   | string               | Free-form string used to decide what fields to expect in the event detail.                                                                        |
| Resources    | string\[] (optional) | AWS resources, identified by Amazon Resource Name (ARN), which the event primarily concerns.                                                      |
| EventBusName | string (optional)    | The event bus that will receive the event. If you omit this, the default event bus is used. Only the AWS account that owns a bus can write to it. |

### Returns

Expand table

| Type            | Description                                                                   |
|-----------------|-------------------------------------------------------------------------------|
| `Promise<void>` | A Promise that fulfills when the events have been sent to Amazon EventBridge. |

### Example

JavaScript ![Copy code to clipboard](/media/images/icons/icon-copy-small-2.svg) Copy

```javascript
import {
  AWSConfig,
  EventBridgeClient,
} from 'https://jslib.k6.io/aws/0.14.0/event-bridge.js';

const awsConfig = new AWSConfig({
  region: __ENV.AWS_REGION,
  accessKeyId: __ENV.AWS_ACCESS_KEY_ID,
  secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY,
  sessionToken: __ENV.AWS_SESSION_TOKEN,
});

const eventBridge = new EventBridgeClient(awsConfig);
const eventEntry = {
  Source: 'my.source',
  Detail: {
    key: 'value',
  },
  DetailType: 'MyDetailType',
  Resources: ['resource-arn'],
};

export default async function () {
  await eventBridge.putEvents({
    Entries: [eventEntry],
  });
}
```
