# Amazon EventBridge Pipes Sources Construct Library

> Version 2.275.0-alpha.0

> **Separate package**
>
> `@aws-cdk/aws-pipes-sources-alpha` is not part of `aws-cdk-lib` — install it separately:
>
> ```sh
> npm install @aws-cdk/aws-pipes-sources-alpha
> pip install aws-cdk.aws-pipes-sources-alpha
> ```
>
> This module is [**experimental**](/stability) (alpha): its API may change in any release, without a major version bump.
---

![cdk-constructs: Experimental](https://img.shields.io/badge/cdk--constructs-experimental-important.svg?style=for-the-badge)

> The APIs of higher level constructs in this module are experimental and under active development.
> They are subject to non-backward compatible changes or removal in any future version. These are
> not subject to the [Semantic Versioning](https://semver.org/) model and breaking changes will be
> announced in the release notes. This means that while you may use them, you may need to update
> your source code when upgrading to a newer version of this package.

---

EventBridge Pipes Sources let you create a source for a EventBridge Pipe.

For more details see the service documentation:

[Documentation](https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-pipes-event-source.html)

## Pipe sources

Pipe sources are the starting point of a EventBridge Pipe. They are the source of the events that are sent to the pipe.

### Amazon SQS

A SQS message queue can be used as a source for a pipe. The queue will be polled for new messages and the messages will be sent to the pipe.

```ts
declare const sourceQueue: sqs.Queue;
declare const targetQueue: sqs.Queue;

const pipeSource = new sources.SqsSource(sourceQueue);

const pipe = new pipes.Pipe(this, 'Pipe', {
  source: pipeSource,
  target: new SqsTarget(targetQueue)
});
```

The polling configuration can be customized:

```ts
declare const sourceQueue: sqs.Queue;
declare const targetQueue: sqs.Queue;

const pipeSource = new sources.SqsSource(sourceQueue, {
  batchSize: 10,
  maximumBatchingWindow: cdk.Duration.seconds(10)
});

const pipe = new pipes.Pipe(this, 'Pipe', {
  source: pipeSource,
  target: new SqsTarget(targetQueue)
});
```

### Amazon Kinesis

A Kinesis stream can be used as a source for a pipe. The stream will be polled for new messages and the messages will be sent to the pipe.

```ts
declare const sourceStream: kinesis.Stream;
declare const targetQueue: sqs.Queue;

const pipeSource = new sources.KinesisSource(sourceStream, {
  startingPosition: sources.KinesisStartingPosition.LATEST,
});

const pipe = new pipes.Pipe(this, 'Pipe', {
  source: pipeSource,
  target: new SqsTarget(targetQueue)
});
```

### Amazon DynamoDB

A DynamoDB stream can be used as a source for a pipe. The stream will be polled for new messages and the messages will be sent to the pipe.

```ts
const table = new ddb.TableV2(this, 'MyTable', {
  partitionKey: {
    name: 'id',
    type: ddb.AttributeType.STRING,
  },
  dynamoStream: ddb.StreamViewType.NEW_IMAGE,
});
declare const targetQueue: sqs.Queue;

const pipeSource = new sources.DynamoDBSource(table, {
  startingPosition: sources.DynamoDBStartingPosition.LATEST,
});

const pipe = new pipes.Pipe(this, 'Pipe', {
  source: pipeSource,
  target: new SqsTarget(targetQueue)
});
```

## Types

| Name | Kind | Summary |
| --- | --- | --- |
| [`DynamoDBSource`](/v2/docs/@aws-cdk_aws-pipes-sources-alpha.DynamoDBSource) | Class | A source that reads from an DynamoDB stream. |
| [`DynamoDBSourceParameters`](/v2/docs/@aws-cdk_aws-pipes-sources-alpha.DynamoDBSourceParameters) | Struct | Parameters for the DynamoDB source. |
| [`DynamoDBStartingPosition`](/v2/docs/@aws-cdk_aws-pipes-sources-alpha.DynamoDBStartingPosition) | Enum | The position in a DynamoDB stream from which to start reading. |
| [`KinesisSource`](/v2/docs/@aws-cdk_aws-pipes-sources-alpha.KinesisSource) | Class | A source that reads from Kinesis. |
| [`KinesisSourceParameters`](/v2/docs/@aws-cdk_aws-pipes-sources-alpha.KinesisSourceParameters) | Struct | Parameters for the Kinesis source. |
| [`KinesisStartingPosition`](/v2/docs/@aws-cdk_aws-pipes-sources-alpha.KinesisStartingPosition) | Enum | The position in a Kinesis stream from which to start reading. |
| [`OnPartialBatchItemFailure`](/v2/docs/@aws-cdk_aws-pipes-sources-alpha.OnPartialBatchItemFailure) | Enum | Define how to handle item process failures. |
| [`SqsSource`](/v2/docs/@aws-cdk_aws-pipes-sources-alpha.SqsSource) | Class | A source that reads from an SQS queue. |
| [`SqsSourceParameters`](/v2/docs/@aws-cdk_aws-pipes-sources-alpha.SqsSourceParameters) | Struct | Parameters for the SQS source. |
| [`StreamSource`](/v2/docs/@aws-cdk_aws-pipes-sources-alpha.StreamSource) | Class | Streaming sources. |
| [`StreamSourceParameters`](/v2/docs/@aws-cdk_aws-pipes-sources-alpha.StreamSourceParameters) | Struct | Base parameters for streaming sources. |
