Package software.amazon.awscdk.services.pipes.targets.alpha
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.CloudWatchLogsTarget
: Send event source to a CloudWatch Logs log grouptargets.EventBridgeTarget
: Send event source to an EventBridge event bustargets.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.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; ApiDestinationTarget apiTarget = new ApiDestinationTarget(dest); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(apiTarget) .build();
The input to the target API destination can be transformed:
Queue sourceQueue; ApiDestination dest; ApiDestinationTarget apiTarget = ApiDestinationTarget.Builder.create(dest) .inputTransformation(InputTransformation.fromObject(Map.of("body", "👀"))) .build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(apiTarget) .build();
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; CloudWatchLogsTarget logGroupTarget = new CloudWatchLogsTarget(targetLogGroup); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(logGroupTarget) .build();
The input to the target log group can be transformed:
Queue sourceQueue; LogGroup targetLogGroup; CloudWatchLogsTarget logGroupTarget = CloudWatchLogsTarget.Builder.create(targetLogGroup) .inputTransformation(InputTransformation.fromObject(Map.of("body", "👀"))) .build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(logGroupTarget) .build();
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; EventBridgeTarget eventBusTarget = new EventBridgeTarget(targetEventBus); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(eventBusTarget) .build();
The input to the target event bus can be transformed:
Queue sourceQueue; EventBus targetEventBus; EventBridgeTarget eventBusTarget = EventBridgeTarget.Builder.create(targetEventBus) .inputTransformation(InputTransformation.fromObject(Map.of("body", "👀"))) .build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(eventBusTarget) .build();
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; KinesisTarget streamTarget = KinesisTarget.Builder.create(targetStream) .partitionKey("pk") .build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(streamTarget) .build();
The input to the target data stream can be transformed:
Queue sourceQueue; Stream targetStream; KinesisTarget streamTarget = KinesisTarget.Builder.create(targetStream) .partitionKey("pk") .inputTransformation(InputTransformation.fromObject(Map.of("body", "👀"))) .build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(streamTarget) .build();
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; LambdaFunction pipeTarget = LambdaFunction.Builder.create(targetFunction).build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(pipeTarget) .build();
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; LambdaFunction pipeTarget = LambdaFunction.Builder.create(targetFunction) .invocationType(LambdaFunctionInvocationType.FIRE_AND_FORGET) .build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(pipeTarget) .build();
The input to the target Lambda Function can be transformed:
Queue sourceQueue; IFunction targetFunction; LambdaFunction pipeTarget = LambdaFunction.Builder.create(targetFunction) .inputTransformation(InputTransformation.fromObject(Map.of("body", "👀"))) .build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(pipeTarget) .build();
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; SageMakerTarget pipelineTarget = new SageMakerTarget(targetPipeline); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(pipelineTarget) .build();
The input to the target pipeline can be transformed:
Queue sourceQueue; IPipeline targetPipeline; SageMakerTarget pipelineTarget = SageMakerTarget.Builder.create(targetPipeline) .inputTransformation(InputTransformation.fromObject(Map.of("body", "👀"))) .build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(pipelineTarget) .build();
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; SfnStateMachine pipeTarget = SfnStateMachine.Builder.create(targetStateMachine).build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(pipeTarget) .build();
You can specify the invocation type when the target state machine is invoked:
Queue sourceQueue; IStateMachine targetStateMachine; SfnStateMachine pipeTarget = SfnStateMachine.Builder.create(targetStateMachine) .invocationType(StateMachineInvocationType.FIRE_AND_FORGET) .build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(pipeTarget) .build();
The input to the target state machine can be transformed:
Queue sourceQueue; IStateMachine targetStateMachine; SfnStateMachine pipeTarget = SfnStateMachine.Builder.create(targetStateMachine) .inputTransformation(InputTransformation.fromObject(Map.of("body", "<$.body>"))) .invocationType(StateMachineInvocationType.FIRE_AND_FORGET) .build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(pipeTarget) .build();
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; SqsTarget pipeTarget = new SqsTarget(targetQueue); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(pipeTarget) .build();
The target input can be transformed:
Queue sourceQueue; Queue targetQueue; SqsTarget pipeTarget = SqsTarget.Builder.create(targetQueue) .inputTransformation(InputTransformation.fromObject(Map.of( "SomeKey", DynamicInput.fromEventPath("$.body")))) .build(); Pipe pipe = Pipe.Builder.create(this, "Pipe") .source(new SqsSource(sourceQueue)) .target(pipeTarget) .build();
-
ClassDescription(experimental) A EventBridge Pipes target that sends messages to an EventBridge API destination.(experimental) A fluent builder for
ApiDestinationTarget
.(experimental) EventBridge API destination target properties.A builder forApiDestinationTargetParameters
An implementation forApiDestinationTargetParameters
(experimental) An EventBridge Pipes target that sends messages to a CloudWatch Logs log group.(experimental) A fluent builder forCloudWatchLogsTarget
.(experimental) CloudWatch Logs target properties.A builder forCloudWatchLogsTargetParameters
An implementation forCloudWatchLogsTargetParameters
(experimental) An EventBridge Pipes target that sends messages to an EventBridge event bus.(experimental) A fluent builder forEventBridgeTarget
.(experimental) EventBridge target properties.A builder forEventBridgeTargetParameters
An implementation forEventBridgeTargetParameters
(experimental) An EventBridge Pipes target that sends messages to a Kinesis stream.(experimental) A fluent builder forKinesisTarget
.(experimental) Kinesis target properties.A builder forKinesisTargetParameters
An implementation forKinesisTargetParameters
(experimental) An EventBridge Pipes target that sends messages to an AWS Lambda Function.(experimental) A fluent builder forLambdaFunction
.(experimental) InvocationType for invoking the Lambda Function.(experimental) Parameters for the LambdaFunction target.A builder forLambdaFunctionParameters
An implementation forLambdaFunctionParameters
(experimental) An EventBridge Pipes target that sends messages to a SageMaker pipeline.(experimental) A fluent builder forSageMakerTarget
.(experimental) SageMaker target properties.A builder forSageMakerTargetParameters
An implementation forSageMakerTargetParameters
(experimental) An EventBridge Pipes target that sends messages to an AWS Step Functions State Machine.(experimental) A fluent builder forSfnStateMachine
.(experimental) Parameters for the SfnStateMachine target.A builder forSfnStateMachineParameters
An implementation forSfnStateMachineParameters
(experimental) A EventBridge Pipes target that sends messages to an SQS queue.(experimental) A fluent builder forSqsTarget
.(experimental) SQS target properties.A builder forSqsTargetParameters
An implementation forSqsTargetParameters
(experimental) InvocationType for invoking the State Machine.