aws-cdk-lib.aws_events.CfnRule.TargetProperty

interface TargetProperty

LanguageType name
.NETAmazon.CDK.AWS.Events.CfnRule.TargetProperty
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsevents#CfnRule_TargetProperty
Javasoftware.amazon.awscdk.services.events.CfnRule.TargetProperty
Pythonaws_cdk.aws_events.CfnRule.TargetProperty
TypeScript aws-cdk-lib » aws_events » CfnRule » TargetProperty

Targets are the resources to be invoked when a rule is triggered.

For a complete list of services and resources that can be set as a target, see PutTargets .

If you are setting the event bus of another account as the target, and that account granted permission to your account through an organization instead of directly by the account ID, then you must specify a RoleArn with proper permissions in the Target structure. For more information, see Sending and Receiving Events Between AWS Accounts in the Amazon EventBridge User Guide .

Example

// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_events as events } from 'aws-cdk-lib';
const targetProperty: events.CfnRule.TargetProperty = {
  arn: 'arn',
  id: 'id',

  // the properties below are optional
  batchParameters: {
    jobDefinition: 'jobDefinition',
    jobName: 'jobName',

    // the properties below are optional
    arrayProperties: {
      size: 123,
    },
    retryStrategy: {
      attempts: 123,
    },
  },
  deadLetterConfig: {
    arn: 'arn',
  },
  ecsParameters: {
    taskDefinitionArn: 'taskDefinitionArn',

    // the properties below are optional
    capacityProviderStrategy: [{
      capacityProvider: 'capacityProvider',

      // the properties below are optional
      base: 123,
      weight: 123,
    }],
    enableEcsManagedTags: false,
    enableExecuteCommand: false,
    group: 'group',
    launchType: 'launchType',
    networkConfiguration: {
      awsVpcConfiguration: {
        subnets: ['subnets'],

        // the properties below are optional
        assignPublicIp: 'assignPublicIp',
        securityGroups: ['securityGroups'],
      },
    },
    placementConstraints: [{
      expression: 'expression',
      type: 'type',
    }],
    placementStrategies: [{
      field: 'field',
      type: 'type',
    }],
    platformVersion: 'platformVersion',
    propagateTags: 'propagateTags',
    referenceId: 'referenceId',
    tagList: [{
      key: 'key',
      value: 'value',
    }],
    taskCount: 123,
  },
  httpParameters: {
    headerParameters: {
      headerParametersKey: 'headerParameters',
    },
    pathParameterValues: ['pathParameterValues'],
    queryStringParameters: {
      queryStringParametersKey: 'queryStringParameters',
    },
  },
  input: 'input',
  inputPath: 'inputPath',
  inputTransformer: {
    inputTemplate: 'inputTemplate',

    // the properties below are optional
    inputPathsMap: {
      inputPathsMapKey: 'inputPathsMap',
    },
  },
  kinesisParameters: {
    partitionKeyPath: 'partitionKeyPath',
  },
  redshiftDataParameters: {
    database: 'database',
    sql: 'sql',

    // the properties below are optional
    dbUser: 'dbUser',
    secretManagerArn: 'secretManagerArn',
    statementName: 'statementName',
    withEvent: false,
  },
  retryPolicy: {
    maximumEventAgeInSeconds: 123,
    maximumRetryAttempts: 123,
  },
  roleArn: 'roleArn',
  runCommandParameters: {
    runCommandTargets: [{
      key: 'key',
      values: ['values'],
    }],
  },
  sageMakerPipelineParameters: {
    pipelineParameterList: [{
      name: 'name',
      value: 'value',
    }],
  },
  sqsParameters: {
    messageGroupId: 'messageGroupId',
  },
};

Properties

NameTypeDescription
arnstringThe Amazon Resource Name (ARN) of the target.
idstringThe ID of the target within the specified rule.
batchParameters?IResolvable | BatchParametersPropertyIf the event target is an AWS Batch job, this contains the job definition, job name, and other parameters.
deadLetterConfig?IResolvable | DeadLetterConfigPropertyThe DeadLetterConfig that defines the target queue to send dead-letter queue events to.
ecsParameters?IResolvable | EcsParametersPropertyContains the Amazon ECS task definition and task count to be used, if the event target is an Amazon ECS task.
httpParameters?IResolvable | HttpParametersPropertyContains the HTTP parameters to use when the target is a API Gateway endpoint or EventBridge ApiDestination.
input?stringValid JSON text passed to the target.
inputPath?stringThe value of the JSONPath that is used for extracting part of the matched event when passing it to the target.
inputTransformer?IResolvable | InputTransformerPropertySettings to enable you to provide custom input to a target based on certain event data.
kinesisParameters?IResolvable | KinesisParametersPropertyThe custom parameter you can use to control the shard assignment, when the target is a Kinesis data stream.
redshiftDataParameters?IResolvable | RedshiftDataParametersPropertyContains the Amazon Redshift Data API parameters to use when the target is a Amazon Redshift cluster.
retryPolicy?IResolvable | RetryPolicyPropertyThe RetryPolicy object that contains the retry policy configuration to use for the dead-letter queue.
roleArn?stringThe Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered.
runCommandParameters?IResolvable | RunCommandParametersPropertyParameters used when you are using the rule to invoke Amazon EC2 Run Command.
sageMakerPipelineParameters?IResolvable | SageMakerPipelineParametersPropertyContains the SageMaker Model Building Pipeline parameters to start execution of a SageMaker Model Building Pipeline.
sqsParameters?IResolvable | SqsParametersPropertyContains the message group ID to use when the target is a FIFO queue.

arn

Type: string

The Amazon Resource Name (ARN) of the target.


id

Type: string

The ID of the target within the specified rule.

Use this ID to reference the target when updating the rule. We recommend using a memorable and unique string.


batchParameters?

Type: IResolvable | BatchParametersProperty (optional)

If the event target is an AWS Batch job, this contains the job definition, job name, and other parameters.

For more information, see Jobs in the AWS Batch User Guide .


deadLetterConfig?

Type: IResolvable | DeadLetterConfigProperty (optional)

The DeadLetterConfig that defines the target queue to send dead-letter queue events to.


ecsParameters?

Type: IResolvable | EcsParametersProperty (optional)

Contains the Amazon ECS task definition and task count to be used, if the event target is an Amazon ECS task.

For more information about Amazon ECS tasks, see Task Definitions in the Amazon EC2 Container Service Developer Guide .


httpParameters?

Type: IResolvable | HttpParametersProperty (optional)

Contains the HTTP parameters to use when the target is a API Gateway endpoint or EventBridge ApiDestination.

If you specify an API Gateway API or EventBridge ApiDestination as a target, you can use this parameter to specify headers, path parameters, and query string keys/values as part of your target invoking request. If you're using ApiDestinations, the corresponding Connection can also have these values configured. In case of any conflicting keys, values from the Connection take precedence.


input?

Type: string (optional)

Valid JSON text passed to the target.

In this case, nothing from the event itself is passed to the target. For more information, see The JavaScript Object Notation (JSON) Data Interchange Format .


inputPath?

Type: string (optional)

The value of the JSONPath that is used for extracting part of the matched event when passing it to the target.

You may use JSON dot notation or bracket notation. For more information about JSON paths, see JSONPath .


inputTransformer?

Type: IResolvable | InputTransformerProperty (optional)

Settings to enable you to provide custom input to a target based on certain event data.

You can extract one or more key-value pairs from the event and then use that data to send customized input to the target.


kinesisParameters?

Type: IResolvable | KinesisParametersProperty (optional)

The custom parameter you can use to control the shard assignment, when the target is a Kinesis data stream.

If you do not include this parameter, the default is to use the eventId as the partition key.


redshiftDataParameters?

Type: IResolvable | RedshiftDataParametersProperty (optional)

Contains the Amazon Redshift Data API parameters to use when the target is a Amazon Redshift cluster.

If you specify a Amazon Redshift Cluster as a Target, you can use this to specify parameters to invoke the Amazon Redshift Data API ExecuteStatement based on EventBridge events.


retryPolicy?

Type: IResolvable | RetryPolicyProperty (optional)

The RetryPolicy object that contains the retry policy configuration to use for the dead-letter queue.


roleArn?

Type: string (optional)

The Amazon Resource Name (ARN) of the IAM role to be used for this target when the rule is triggered.

If one rule triggers multiple targets, you can use a different IAM role for each target.


runCommandParameters?

Type: IResolvable | RunCommandParametersProperty (optional)

Parameters used when you are using the rule to invoke Amazon EC2 Run Command.


sageMakerPipelineParameters?

Type: IResolvable | SageMakerPipelineParametersProperty (optional)

Contains the SageMaker Model Building Pipeline parameters to start execution of a SageMaker Model Building Pipeline.

If you specify a SageMaker Model Building Pipeline as a target, you can use this to specify parameters to start a pipeline execution based on EventBridge events.


sqsParameters?

Type: IResolvable | SqsParametersProperty (optional)

Contains the message group ID to use when the target is a FIFO queue.

If you specify an SQS FIFO queue as a target, the queue must have content-based deduplication enabled.