Amazon.CDK.AWS.Pipes.Targets.Alpha
The CDK Construct Library for Amazon EventBridge Pipes Targets (Stability: Experimental)
Install
| Product | Versions |
|---|---|
| .NET |
README
Amazon EventBridge Pipes Targets Construct Library
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 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 Targets let you create a target for an EventBridge Pipe.
For more details see the service documentation.
Targets
Pipe targets are the end point of an EventBridge Pipe. The following targets are supported:
targets.ApiDestinationTarget: Send event source to an EventBridge API destinationtargets.ApiGatewayTarget: Send event source to an API Gateway REST APItargets.CloudWatchLogsTarget: Send event source to a CloudWatch Logs log grouptargets.EventBridgeTarget: Send event source to an EventBridge event bustargets.FirehoseTarget: Send event source to an Amazon Data Firehose delivery streamtargets.KinesisTarget: Send event source to a Kinesis data streamtargets.LambdaFunction: Send event source to a Lambda functiontargets.SageMakerTarget: Send event source to a SageMaker pipelinetargets.SfnStateMachine: Invoke a Step Functions state machine from an event sourcetargets.SnsTarget: Send event source to an SNS topictargets.SqsTarget: Send event source to an SQS queue
Amazon EventBridge API Destination
An EventBridge API destination can be used as a target for a pipe. The API destination will receive the (enriched/filtered) source payload.
Queue sourceQueue;
ApiDestination dest;
var apiTarget = new ApiDestinationTarget(dest);
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = apiTarget
});
The input to the target API destination can be transformed:
Queue sourceQueue;
ApiDestination dest;
var apiTarget = new ApiDestinationTarget(dest, new ApiDestinationTargetParameters {
InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> { { "body", "π" } })
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = apiTarget
});
Amazon API Gateway Rest API
A REST API can be used as a target for a pipe. The REST API will receive the (enriched/filtered) source payload.
Queue sourceQueue;
var fn = new Function(this, "MyFunc", new FunctionProps {
Handler = "index.handler",
Runtime = Runtime.NODEJS_LATEST,
Code = Code.FromInline("exports.handler = e => {}")
});
var restApi = new LambdaRestApi(this, "MyRestAPI", new LambdaRestApiProps { Handler = fn });
var apiTarget = new ApiGatewayTarget(restApi);
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = apiTarget
});
The input to the target REST API can be transformed:
Queue sourceQueue;
var fn = new Function(this, "MyFunc", new FunctionProps {
Handler = "index.handler",
Runtime = Runtime.NODEJS_LATEST,
Code = Code.FromInline("exports.handler = e => {}")
});
var restApi = new LambdaRestApi(this, "MyRestAPI", new LambdaRestApiProps { Handler = fn });
var apiTarget = new ApiGatewayTarget(restApi, new ApiGatewayTargetParameters {
InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> { { "body", "π" } })
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = apiTarget
});
Amazon CloudWatch Logs Log Group
A CloudWatch Logs log group can be used as a target for a pipe. The log group will receive the (enriched/filtered) source payload.
Queue sourceQueue;
LogGroup targetLogGroup;
var logGroupTarget = new CloudWatchLogsTarget(targetLogGroup);
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = logGroupTarget
});
The input to the target log group can be transformed:
Queue sourceQueue;
LogGroup targetLogGroup;
var logGroupTarget = new CloudWatchLogsTarget(targetLogGroup, new CloudWatchLogsTargetParameters {
InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> { { "body", "π" } })
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = logGroupTarget
});
Amazon EventBridge Event Bus
An EventBridge event bus can be used as a target for a pipe. The event bus will receive the (enriched/filtered) source payload.
Queue sourceQueue;
EventBus targetEventBus;
var eventBusTarget = new EventBridgeTarget(targetEventBus);
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = eventBusTarget
});
The input to the target event bus can be transformed:
Queue sourceQueue;
EventBus targetEventBus;
var eventBusTarget = new EventBridgeTarget(targetEventBus, new EventBridgeTargetParameters {
InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> { { "body", "π" } })
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = eventBusTarget
});
Amazon Data Firehose Delivery Stream
An Amazon Data Firehose delivery stream can be used as a target for a pipe. The delivery stream will receive the (enriched/filtered) source payload.
Queue sourceQueue;
DeliveryStream targetDeliveryStream;
var deliveryStreamTarget = new FirehoseTarget(targetDeliveryStream);
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = deliveryStreamTarget
});
The input to the target delivery stream can be transformed:
Queue sourceQueue;
DeliveryStream targetDeliveryStream;
var deliveryStreamTarget = new FirehoseTarget(targetDeliveryStream, new FirehoseTargetParameters {
InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> { { "body", "π" } })
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = deliveryStreamTarget
});
Amazon Kinesis Data Stream
A Kinesis data stream can be used as a target for a pipe. The data stream will receive the (enriched/filtered) source payload.
Queue sourceQueue;
Stream targetStream;
var streamTarget = new KinesisTarget(targetStream, new KinesisTargetParameters {
PartitionKey = "pk"
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = streamTarget
});
The input to the target data stream can be transformed:
Queue sourceQueue;
Stream targetStream;
var streamTarget = new KinesisTarget(targetStream, new KinesisTargetParameters {
PartitionKey = "pk",
InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> { { "body", "π" } })
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = streamTarget
});
AWS Lambda Function
A Lambda function can be used as a target for a pipe. The Lambda function will be invoked with the (enriched/filtered) source payload.
Queue sourceQueue;
IFunction targetFunction;
var pipeTarget = new LambdaFunction(targetFunction, new LambdaFunctionParameters { });
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = pipeTarget
});
The target Lambda function is invoked synchronously by default. You can also choose to invoke the Lambda Function asynchronously by setting invocationType property to FIRE_AND_FORGET.
Queue sourceQueue;
IFunction targetFunction;
var pipeTarget = new LambdaFunction(targetFunction, new LambdaFunctionParameters {
InvocationType = LambdaFunctionInvocationType.FIRE_AND_FORGET
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = pipeTarget
});
The input to the target Lambda Function can be transformed:
Queue sourceQueue;
IFunction targetFunction;
var pipeTarget = new LambdaFunction(targetFunction, new LambdaFunctionParameters {
InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> { { "body", "π" } })
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = pipeTarget
});
Amazon SageMaker Pipeline
A SageMaker pipeline can be used as a target for a pipe. The pipeline will receive the (enriched/filtered) source payload.
Queue sourceQueue;
IPipeline targetPipeline;
var pipelineTarget = new SageMakerTarget(targetPipeline);
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = pipelineTarget
});
The input to the target pipeline can be transformed:
Queue sourceQueue;
IPipeline targetPipeline;
var pipelineTarget = new SageMakerTarget(targetPipeline, new SageMakerTargetParameters {
InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> { { "body", "π" } })
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = pipelineTarget
});
AWS Step Functions State Machine
A Step Functions state machine can be used as a target for a pipe. The state machine will be invoked with the (enriched/filtered) source payload.
Queue sourceQueue;
IStateMachine targetStateMachine;
var pipeTarget = new SfnStateMachine(targetStateMachine, new SfnStateMachineParameters { });
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = pipeTarget
});
You can specify the invocation type when the target state machine is invoked:
Queue sourceQueue;
IStateMachine targetStateMachine;
var pipeTarget = new SfnStateMachine(targetStateMachine, new SfnStateMachineParameters {
InvocationType = StateMachineInvocationType.FIRE_AND_FORGET
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = pipeTarget
});
The input to the target state machine can be transformed:
Queue sourceQueue;
IStateMachine targetStateMachine;
var pipeTarget = new SfnStateMachine(targetStateMachine, new SfnStateMachineParameters {
InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> { { "body", "<$.body>" } }),
InvocationType = StateMachineInvocationType.FIRE_AND_FORGET
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = pipeTarget
});
Amazon SNS Topic
An SNS topic can be used as a target for a pipe. The topic will receive the (enriched/filtered) source payload.
Queue sourceQueue;
Topic targetTopic;
var pipeTarget = new SnsTarget(targetTopic);
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = pipeTarget
});
The target input can be transformed:
Queue sourceQueue;
Topic targetTopic;
var pipeTarget = new SnsTarget(targetTopic, new SnsTargetParameters {
InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> {
{ "SomeKey", DynamicInput.FromEventPath("$.body") }
})
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = pipeTarget
});
Amazon SQS Queue
An SQS queue can be used as a target for a pipe. The queue will receive the (enriched/filtered) source payload.
Queue sourceQueue;
Queue targetQueue;
var pipeTarget = new SqsTarget(targetQueue);
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = pipeTarget
});
The target input can be transformed:
Queue sourceQueue;
Queue targetQueue;
var pipeTarget = new SqsTarget(targetQueue, new SqsTargetParameters {
InputTransformation = InputTransformation.FromObject(new Dictionary<string, object> {
{ "SomeKey", DynamicInput.FromEventPath("$.body") }
})
});
var pipe = new Pipe(this, "Pipe", new PipeProps {
Source = new SqsSource(sourceQueue),
Target = pipeTarget
});
Changes from Previous Version
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.