Skip to content
v2.277.0

RuleTargetConfig Struct ​

Properties for an event rule target.

Example ​

ts
// 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';
import { aws_iam as iam } from 'aws-cdk-lib';
import * as constructs from 'constructs';

declare const construct: constructs.Construct;
declare const role: iam.Role;
declare const ruleTargetInput: events.RuleTargetInput;
const ruleTargetConfig: events.RuleTargetConfig = {
  arn: 'arn',

  // the properties below are optional
  appSyncParameters: {
    graphQlOperation: 'graphQlOperation',
  },
  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: ruleTargetInput,
  kinesisParameters: {
    partitionKeyPath: 'partitionKeyPath',
  },
  redshiftDataParameters: {
    database: 'database',

    // the properties below are optional
    dbUser: 'dbUser',
    secretManagerArn: 'secretManagerArn',
    sql: 'sql',
    sqls: ['sqls'],
    statementName: 'statementName',
    withEvent: false,
  },
  retryPolicy: {
    maximumEventAgeInSeconds: 123,
    maximumRetryAttempts: 123,
  },
  role: role,
  runCommandParameters: {
    runCommandTargets: [{
      key: 'key',
      values: ['values'],
    }],
  },
  sqsParameters: {
    messageGroupId: 'messageGroupId',
  },
  targetResource: construct,
};
python
from aws_cdk import CfnTag
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_events as events
from aws_cdk import aws_iam as iam
import constructs as constructs

# construct: constructs.Construct
# role: iam.Role
# rule_target_input: events.RuleTargetInput

rule_target_config = events.RuleTargetConfig(
    arn="arn",

    # the properties below are optional
    app_sync_parameters=events.CfnRule.AppSyncParametersProperty(
        graph_ql_operation="graphQlOperation"
    ),
    batch_parameters=events.CfnRule.BatchParametersProperty(
        job_definition="jobDefinition",
        job_name="jobName",

        # the properties below are optional
        array_properties=events.CfnRule.BatchArrayPropertiesProperty(
            size=123
        ),
        retry_strategy=events.CfnRule.BatchRetryStrategyProperty(
            attempts=123
        )
    ),
    dead_letter_config=events.CfnRule.DeadLetterConfigProperty(
        arn="arn"
    ),
    ecs_parameters=events.CfnRule.EcsParametersProperty(
        task_definition_arn="taskDefinitionArn",

        # the properties below are optional
        capacity_provider_strategy=[events.CfnRule.CapacityProviderStrategyItemProperty(
            capacity_provider="capacityProvider",

            # the properties below are optional
            base=123,
            weight=123
        )],
        enable_ecs_managed_tags=False,
        enable_execute_command=False,
        group="group",
        launch_type="launchType",
        network_configuration=events.CfnRule.NetworkConfigurationProperty(
            aws_vpc_configuration=events.CfnRule.AwsVpcConfigurationProperty(
                subnets=["subnets"],

                # the properties below are optional
                assign_public_ip="assignPublicIp",
                security_groups=["securityGroups"]
            )
        ),
        placement_constraints=[events.CfnRule.PlacementConstraintProperty(
            expression="expression",
            type="type"
        )],
        placement_strategies=[events.CfnRule.PlacementStrategyProperty(
            field="field",
            type="type"
        )],
        platform_version="platformVersion",
        propagate_tags="propagateTags",
        reference_id="referenceId",
        tag_list=[CfnTag(
            key="key",
            value="value"
        )],
        task_count=123
    ),
    http_parameters=events.CfnRule.HttpParametersProperty(
        header_parameters={
            "header_parameters_key": "headerParameters"
        },
        path_parameter_values=["pathParameterValues"],
        query_string_parameters={
            "query_string_parameters_key": "queryStringParameters"
        }
    ),
    input=rule_target_input,
    kinesis_parameters=events.CfnRule.KinesisParametersProperty(
        partition_key_path="partitionKeyPath"
    ),
    redshift_data_parameters=events.CfnRule.RedshiftDataParametersProperty(
        database="database",

        # the properties below are optional
        db_user="dbUser",
        secret_manager_arn="secretManagerArn",
        sql="sql",
        sqls=["sqls"],
        statement_name="statementName",
        with_event=False
    ),
    retry_policy=events.CfnRule.RetryPolicyProperty(
        maximum_event_age_in_seconds=123,
        maximum_retry_attempts=123
    ),
    role=role,
    run_command_parameters=events.CfnRule.RunCommandParametersProperty(
        run_command_targets=[events.CfnRule.RunCommandTargetProperty(
            key="key",
            values=["values"]
        )]
    ),
    sqs_parameters=events.CfnRule.SqsParametersProperty(
        message_group_id="messageGroupId"
    ),
    target_resource=construct
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.events.*;
import software.amazon.awscdk.services.iam.*;
import software.constructs.*;

Construct construct;
Role role;
RuleTargetInput ruleTargetInput;

RuleTargetConfig ruleTargetConfig = RuleTargetConfig.builder()
        .arn("arn")

        // the properties below are optional
        .appSyncParameters(AppSyncParametersProperty.builder()
                .graphQlOperation("graphQlOperation")
                .build())
        .batchParameters(BatchParametersProperty.builder()
                .jobDefinition("jobDefinition")
                .jobName("jobName")

                // the properties below are optional
                .arrayProperties(BatchArrayPropertiesProperty.builder()
                        .size(123)
                        .build())
                .retryStrategy(BatchRetryStrategyProperty.builder()
                        .attempts(123)
                        .build())
                .build())
        .deadLetterConfig(DeadLetterConfigProperty.builder()
                .arn("arn")
                .build())
        .ecsParameters(EcsParametersProperty.builder()
                .taskDefinitionArn("taskDefinitionArn")

                // the properties below are optional
                .capacityProviderStrategy(List.of(CapacityProviderStrategyItemProperty.builder()
                        .capacityProvider("capacityProvider")

                        // the properties below are optional
                        .base(123)
                        .weight(123)
                        .build()))
                .enableEcsManagedTags(false)
                .enableExecuteCommand(false)
                .group("group")
                .launchType("launchType")
                .networkConfiguration(NetworkConfigurationProperty.builder()
                        .awsVpcConfiguration(AwsVpcConfigurationProperty.builder()
                                .subnets(List.of("subnets"))

                                // the properties below are optional
                                .assignPublicIp("assignPublicIp")
                                .securityGroups(List.of("securityGroups"))
                                .build())
                        .build())
                .placementConstraints(List.of(PlacementConstraintProperty.builder()
                        .expression("expression")
                        .type("type")
                        .build()))
                .placementStrategies(List.of(PlacementStrategyProperty.builder()
                        .field("field")
                        .type("type")
                        .build()))
                .platformVersion("platformVersion")
                .propagateTags("propagateTags")
                .referenceId("referenceId")
                .tagList(List.of(CfnTag.builder()
                        .key("key")
                        .value("value")
                        .build()))
                .taskCount(123)
                .build())
        .httpParameters(HttpParametersProperty.builder()
                .headerParameters(Map.of(
                        "headerParametersKey", "headerParameters"))
                .pathParameterValues(List.of("pathParameterValues"))
                .queryStringParameters(Map.of(
                        "queryStringParametersKey", "queryStringParameters"))
                .build())
        .input(ruleTargetInput)
        .kinesisParameters(KinesisParametersProperty.builder()
                .partitionKeyPath("partitionKeyPath")
                .build())
        .redshiftDataParameters(RedshiftDataParametersProperty.builder()
                .database("database")

                // the properties below are optional
                .dbUser("dbUser")
                .secretManagerArn("secretManagerArn")
                .sql("sql")
                .sqls(List.of("sqls"))
                .statementName("statementName")
                .withEvent(false)
                .build())
        .retryPolicy(RetryPolicyProperty.builder()
                .maximumEventAgeInSeconds(123)
                .maximumRetryAttempts(123)
                .build())
        .role(role)
        .runCommandParameters(RunCommandParametersProperty.builder()
                .runCommandTargets(List.of(RunCommandTargetProperty.builder()
                        .key("key")
                        .values(List.of("values"))
                        .build()))
                .build())
        .sqsParameters(SqsParametersProperty.builder()
                .messageGroupId("messageGroupId")
                .build())
        .targetResource(construct)
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Events;
using Amazon.CDK.AWS.IAM;
using Constructs;

Construct construct;
Role role;
RuleTargetInput ruleTargetInput;
var ruleTargetConfig = new RuleTargetConfig {
    Arn = "arn",

    // the properties below are optional
    AppSyncParameters = new AppSyncParametersProperty {
        GraphQlOperation = "graphQlOperation"
    },
    BatchParameters = new BatchParametersProperty {
        JobDefinition = "jobDefinition",
        JobName = "jobName",

        // the properties below are optional
        ArrayProperties = new BatchArrayPropertiesProperty {
            Size = 123
        },
        RetryStrategy = new BatchRetryStrategyProperty {
            Attempts = 123
        }
    },
    DeadLetterConfig = new DeadLetterConfigProperty {
        Arn = "arn"
    },
    EcsParameters = new EcsParametersProperty {
        TaskDefinitionArn = "taskDefinitionArn",

        // the properties below are optional
        CapacityProviderStrategy = new [] { new CapacityProviderStrategyItemProperty {
            CapacityProvider = "capacityProvider",

            // the properties below are optional
            Base = 123,
            Weight = 123
        } },
        EnableEcsManagedTags = false,
        EnableExecuteCommand = false,
        Group = "group",
        LaunchType = "launchType",
        NetworkConfiguration = new NetworkConfigurationProperty {
            AwsVpcConfiguration = new AwsVpcConfigurationProperty {
                Subnets = new [] { "subnets" },

                // the properties below are optional
                AssignPublicIp = "assignPublicIp",
                SecurityGroups = new [] { "securityGroups" }
            }
        },
        PlacementConstraints = new [] { new PlacementConstraintProperty {
            Expression = "expression",
            Type = "type"
        } },
        PlacementStrategies = new [] { new PlacementStrategyProperty {
            Field = "field",
            Type = "type"
        } },
        PlatformVersion = "platformVersion",
        PropagateTags = "propagateTags",
        ReferenceId = "referenceId",
        TagList = new [] { new CfnTag {
            Key = "key",
            Value = "value"
        } },
        TaskCount = 123
    },
    HttpParameters = new HttpParametersProperty {
        HeaderParameters = new Dictionary<string, string> {
            { "headerParametersKey", "headerParameters" }
        },
        PathParameterValues = new [] { "pathParameterValues" },
        QueryStringParameters = new Dictionary<string, string> {
            { "queryStringParametersKey", "queryStringParameters" }
        }
    },
    Input = ruleTargetInput,
    KinesisParameters = new KinesisParametersProperty {
        PartitionKeyPath = "partitionKeyPath"
    },
    RedshiftDataParameters = new RedshiftDataParametersProperty {
        Database = "database",

        // the properties below are optional
        DbUser = "dbUser",
        SecretManagerArn = "secretManagerArn",
        Sql = "sql",
        Sqls = new [] { "sqls" },
        StatementName = "statementName",
        WithEvent = false
    },
    RetryPolicy = new RetryPolicyProperty {
        MaximumEventAgeInSeconds = 123,
        MaximumRetryAttempts = 123
    },
    Role = role,
    RunCommandParameters = new RunCommandParametersProperty {
        RunCommandTargets = new [] { new RunCommandTargetProperty {
            Key = "key",
            Values = new [] { "values" }
        } }
    },
    SqsParameters = new SqsParametersProperty {
        MessageGroupId = "messageGroupId"
    },
    TargetResource = construct
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
import constructs "github.com/aws/constructs-go/constructs"

var construct Construct
var role Role
var ruleTargetInput RuleTargetInput

ruleTargetConfig := &RuleTargetConfig{
	Arn: jsii.String("arn"),

	// the properties below are optional
	AppSyncParameters: &AppSyncParametersProperty{
		GraphQlOperation: jsii.String("graphQlOperation"),
	},
	BatchParameters: &BatchParametersProperty{
		JobDefinition: jsii.String("jobDefinition"),
		JobName: jsii.String("jobName"),

		// the properties below are optional
		ArrayProperties: &BatchArrayPropertiesProperty{
			Size: jsii.Number(123),
		},
		RetryStrategy: &BatchRetryStrategyProperty{
			Attempts: jsii.Number(123),
		},
	},
	DeadLetterConfig: &DeadLetterConfigProperty{
		Arn: jsii.String("arn"),
	},
	EcsParameters: &EcsParametersProperty{
		TaskDefinitionArn: jsii.String("taskDefinitionArn"),

		// the properties below are optional
		CapacityProviderStrategy: []interface{}{
			&CapacityProviderStrategyItemProperty{
				CapacityProvider: jsii.String("capacityProvider"),

				// the properties below are optional
				Base: jsii.Number(123),
				Weight: jsii.Number(123),
			},
		},
		EnableEcsManagedTags: jsii.Boolean(false),
		EnableExecuteCommand: jsii.Boolean(false),
		Group: jsii.String("group"),
		LaunchType: jsii.String("launchType"),
		NetworkConfiguration: &NetworkConfigurationProperty{
			AwsVpcConfiguration: &AwsVpcConfigurationProperty{
				Subnets: []*string{
					jsii.String("subnets"),
				},

				// the properties below are optional
				AssignPublicIp: jsii.String("assignPublicIp"),
				SecurityGroups: []*string{
					jsii.String("securityGroups"),
				},
			},
		},
		PlacementConstraints: []interface{}{
			&PlacementConstraintProperty{
				Expression: jsii.String("expression"),
				Type: jsii.String("type"),
			},
		},
		PlacementStrategies: []interface{}{
			&PlacementStrategyProperty{
				Field: jsii.String("field"),
				Type: jsii.String("type"),
			},
		},
		PlatformVersion: jsii.String("platformVersion"),
		PropagateTags: jsii.String("propagateTags"),
		ReferenceId: jsii.String("referenceId"),
		TagList: []interface{}{
			&CfnTag{
				Key: jsii.String("key"),
				Value: jsii.String("value"),
			},
		},
		TaskCount: jsii.Number(123),
	},
	HttpParameters: &HttpParametersProperty{
		HeaderParameters: map[string]*string{
			"headerParametersKey": jsii.String("headerParameters"),
		},
		PathParameterValues: []*string{
			jsii.String("pathParameterValues"),
		},
		QueryStringParameters: map[string]*string{
			"queryStringParametersKey": jsii.String("queryStringParameters"),
		},
	},
	Input: ruleTargetInput,
	KinesisParameters: &KinesisParametersProperty{
		PartitionKeyPath: jsii.String("partitionKeyPath"),
	},
	RedshiftDataParameters: &RedshiftDataParametersProperty{
		Database: jsii.String("database"),

		// the properties below are optional
		DbUser: jsii.String("dbUser"),
		SecretManagerArn: jsii.String("secretManagerArn"),
		Sql: jsii.String("sql"),
		Sqls: []*string{
			jsii.String("sqls"),
		},
		StatementName: jsii.String("statementName"),
		WithEvent: jsii.Boolean(false),
	},
	RetryPolicy: &RetryPolicyProperty{
		MaximumEventAgeInSeconds: jsii.Number(123),
		MaximumRetryAttempts: jsii.Number(123),
	},
	Role: role,
	RunCommandParameters: &RunCommandParametersProperty{
		RunCommandTargets: []interface{}{
			&RunCommandTargetProperty{
				Key: jsii.String("key"),
				Values: []*string{
					jsii.String("values"),
				},
			},
		},
	},
	SqsParameters: &SqsParametersProperty{
		MessageGroupId: jsii.String("messageGroupId"),
	},
	TargetResource: construct,
}

Properties ​

appSyncParametersoptionalCfnRule.AppSyncParametersPropertyapp_sync_parametersoptionalAppSyncParametersPropertyappSyncParametersoptionalAppSyncParametersPropertyAppSyncParametersoptionalAppSyncParametersPropertyAppSyncParametersoptionalAppSyncParametersProperty = None #
Contains the GraphQL operation to be parsed and executed, if the event target is an AWS AppSync API.
arnstringarnstrarnStringArnstringArn*string required #
The Amazon Resource Name (ARN) of the target.
batchParametersoptionalCfnRule.BatchParametersPropertybatch_parametersoptionalBatchParametersPropertybatchParametersoptionalBatchParametersPropertyBatchParametersoptionalBatchParametersPropertyBatchParametersoptionalBatchParametersProperty #
Parameters used when the rule invokes Amazon AWS Batch Job/Queue.

Default: no parameters set

deadLetterConfigoptionalCfnRule.DeadLetterConfigPropertydead_letter_configoptionalDeadLetterConfigPropertydeadLetterConfigoptionalDeadLetterConfigPropertyDeadLetterConfigoptionalDeadLetterConfigPropertyDeadLetterConfigoptionalDeadLetterConfigProperty #
Contains information about a dead-letter queue configuration.

Default: no dead-letter queue set

ecsParametersoptionalCfnRule.EcsParametersPropertyecs_parametersoptionalEcsParametersPropertyecsParametersoptionalEcsParametersPropertyEcsParametersoptionalEcsParametersPropertyEcsParametersoptionalEcsParametersProperty #
The Amazon ECS task definition and task count to use, if the event target is an Amazon ECS task.
httpParametersoptionalCfnRule.HttpParametersPropertyhttp_parametersoptionalHttpParametersPropertyhttpParametersoptionalHttpParametersPropertyHttpParametersoptionalHttpParametersPropertyHttpParametersoptionalHttpParametersProperty = None #
Contains the HTTP parameters to use when the target is a API Gateway REST endpoint or EventBridge API destination.
inputoptionalRuleTargetInputinputoptionalRuleTargetInputinputoptionalRuleTargetInputInputoptionalRuleTargetInputInputoptionalRuleTargetInput #
What input to send to the event target.

Default: the entire event

kinesisParametersoptionalCfnRule.KinesisParametersPropertykinesis_parametersoptionalKinesisParametersPropertykinesisParametersoptionalKinesisParametersPropertyKinesisParametersoptionalKinesisParametersPropertyKinesisParametersoptionalKinesisParametersProperty #
Settings that control shard assignment, when the target is a Kinesis stream.

If you don't include this parameter, eventId is used as the partition key.

redshiftDataParametersoptionalCfnRule.RedshiftDataParametersPropertyredshift_data_parametersoptionalRedshiftDataParametersPropertyredshiftDataParametersoptionalRedshiftDataParametersPropertyRedshiftDataParametersoptionalRedshiftDataParametersPropertyRedshiftDataParametersoptionalRedshiftDataParametersProperty #
Parameters used when the rule invokes Amazon Redshift Queries.

Default: no parameters set

retryPolicyoptionalCfnRule.RetryPolicyPropertyretry_policyoptionalRetryPolicyPropertyretryPolicyoptionalRetryPolicyPropertyRetryPolicyoptionalRetryPolicyPropertyRetryPolicyoptionalRetryPolicyProperty #
A RetryPolicy object that includes information about the retry policy settings.

Default: EventBridge default retry policy

roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole #
Role to use to invoke this event target.
runCommandParametersoptionalCfnRule.RunCommandParametersPropertyrun_command_parametersoptionalRunCommandParametersPropertyrunCommandParametersoptionalRunCommandParametersPropertyRunCommandParametersoptionalRunCommandParametersPropertyRunCommandParametersoptionalRunCommandParametersProperty #
Parameters used when the rule invokes Amazon EC2 Systems Manager Run Command.
sqsParametersoptionalCfnRule.SqsParametersPropertysqs_parametersoptionalSqsParametersPropertysqsParametersoptionalSqsParametersPropertySqsParametersoptionalSqsParametersPropertySqsParametersoptionalSqsParametersProperty #
Parameters used when the FIFO sqs queue is used an event target by the rule.
targetResourceoptionalIConstructtarget_resourceoptionalIConstructtargetResourceoptionalIConstructTargetResourceoptionalIConstructTargetResourceoptionalIConstruct #
The resource that is backing this target.

Default: the target is not backed by any resource

notes

This is the resource that will actually have some action performed on it when used as a target (for example, start a build for a CodeBuild project). We need it to determine whether the rule belongs to a different account than the target - if so, we generate a more complex setup, including an additional stack containing the EventBusPolicy.