TargetProperty Struct
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 .
| Source | |
|---|---|
| Type last changed |
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
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: 'input',
inputPath: 'inputPath',
inputTransformer: {
inputTemplate: 'inputTemplate',
// the properties below are optional
inputPathsMap: {
inputPathsMapKey: 'inputPathsMap',
},
},
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,
},
roleArn: 'roleArn',
runCommandParameters: {
runCommandTargets: [{
key: 'key',
values: ['values'],
}],
},
sageMakerPipelineParameters: {
pipelineParameterList: [{
name: 'name',
value: 'value',
}],
},
sqsParameters: {
messageGroupId: 'messageGroupId',
},
};
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
target_property = events.CfnRule.TargetProperty(
arn="arn",
id="id",
# 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="input",
input_path="inputPath",
input_transformer=events.CfnRule.InputTransformerProperty(
input_template="inputTemplate",
# the properties below are optional
input_paths_map={
"input_paths_map_key": "inputPathsMap"
}
),
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_arn="roleArn",
run_command_parameters=events.CfnRule.RunCommandParametersProperty(
run_command_targets=[events.CfnRule.RunCommandTargetProperty(
key="key",
values=["values"]
)]
),
sage_maker_pipeline_parameters=events.CfnRule.SageMakerPipelineParametersProperty(
pipeline_parameter_list=[events.CfnRule.SageMakerPipelineParameterProperty(
name="name",
value="value"
)]
),
sqs_parameters=events.CfnRule.SqsParametersProperty(
message_group_id="messageGroupId"
)
)
// 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.*;
TargetProperty targetProperty = TargetProperty.builder()
.arn("arn")
.id("id")
// 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("input")
.inputPath("inputPath")
.inputTransformer(InputTransformerProperty.builder()
.inputTemplate("inputTemplate")
// the properties below are optional
.inputPathsMap(Map.of(
"inputPathsMapKey", "inputPathsMap"))
.build())
.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())
.roleArn("roleArn")
.runCommandParameters(RunCommandParametersProperty.builder()
.runCommandTargets(List.of(RunCommandTargetProperty.builder()
.key("key")
.values(List.of("values"))
.build()))
.build())
.sageMakerPipelineParameters(SageMakerPipelineParametersProperty.builder()
.pipelineParameterList(List.of(SageMakerPipelineParameterProperty.builder()
.name("name")
.value("value")
.build()))
.build())
.sqsParameters(SqsParametersProperty.builder()
.messageGroupId("messageGroupId")
.build())
.build();
// 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;
var targetProperty = new TargetProperty {
Arn = "arn",
Id = "id",
// 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 = "input",
InputPath = "inputPath",
InputTransformer = new InputTransformerProperty {
InputTemplate = "inputTemplate",
// the properties below are optional
InputPathsMap = new Dictionary<string, string> {
{ "inputPathsMapKey", "inputPathsMap" }
}
},
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
},
RoleArn = "roleArn",
RunCommandParameters = new RunCommandParametersProperty {
RunCommandTargets = new [] { new RunCommandTargetProperty {
Key = "key",
Values = new [] { "values" }
} }
},
SageMakerPipelineParameters = new SageMakerPipelineParametersProperty {
PipelineParameterList = new [] { new SageMakerPipelineParameterProperty {
Name = "name",
Value = "value"
} }
},
SqsParameters = new SqsParametersProperty {
MessageGroupId = "messageGroupId"
}
};
// 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"
targetProperty := &TargetProperty{
Arn: jsii.String("arn"),
Id: jsii.String("id"),
// 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: jsii.String("input"),
InputPath: jsii.String("inputPath"),
InputTransformer: &InputTransformerProperty{
InputTemplate: jsii.String("inputTemplate"),
// the properties below are optional
InputPathsMap: map[string]*string{
"inputPathsMapKey": jsii.String("inputPathsMap"),
},
},
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),
},
RoleArn: jsii.String("roleArn"),
RunCommandParameters: &RunCommandParametersProperty{
RunCommandTargets: []interface{}{
&RunCommandTargetProperty{
Key: jsii.String("key"),
Values: []*string{
jsii.String("values"),
},
},
},
},
SageMakerPipelineParameters: &SageMakerPipelineParametersProperty{
PipelineParameterList: []interface{}{
&SageMakerPipelineParameterProperty{
Name: jsii.String("name"),
Value: jsii.String("value"),
},
},
},
SqsParameters: &SqsParametersProperty{
MessageGroupId: jsii.String("messageGroupId"),
},
}
Properties
appSyncParametersoptionalIResolvable | CfnRule.app_sync_parametersoptionaltyping.Union[IResolvable, AppSyncParametersProperty]appSyncParametersoptionalIResolvableAppSyncParametersoptionalIResolvableAppSyncParametersoptionalinterface{} #batchParametersoptionalIResolvable | CfnRule.BatchParametersPropertybatch_parametersoptionaltyping.Union[IResolvable, BatchParametersProperty]batchParametersoptionalIResolvableBatchParametersoptionalIResolvableBatchParametersoptionalinterface{} #For more information, see Jobs in the AWS Batch User Guide .
deadLetterConfigoptionalIResolvable | CfnRule.DeadLetterConfigPropertydead_letter_configoptionaltyping.Union[IResolvable, DeadLetterConfigProperty]deadLetterConfigoptionalIResolvableDeadLetterConfigoptionalIResolvableDeadLetterConfigoptionalinterface{} #ecsParametersoptionalIResolvable | CfnRule.EcsParametersPropertyecs_parametersoptionaltyping.Union[IResolvable, EcsParametersProperty]ecsParametersoptionalIResolvableEcsParametersoptionalIResolvableEcsParametersoptionalinterface{} #For more information about Amazon ECS tasks, see Task Definitions in the Amazon EC2 Container Service Developer Guide .
httpParametersoptionalIResolvable | CfnRule.HttpParametersPropertyhttp_parametersoptionaltyping.Union[IResolvable, HttpParametersProperty]httpParametersoptionalIResolvableHttpParametersoptionalIResolvableHttpParametersoptionalinterface{} #notes
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.
Use this ID to reference the target when updating the rule. We recommend using a memorable and unique string.
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 .
inputPathoptionalstringinput_pathoptionalstrinputPathoptionalStringInputPathoptionalstringInputPathoptional*string #You may use JSON dot notation or bracket notation. For more information about JSON paths, see JSONPath .
inputTransformeroptionalIResolvable | CfnRule.InputTransformerPropertyinput_transformeroptionaltyping.Union[IResolvable, InputTransformerProperty]inputTransformeroptionalIResolvableInputTransformeroptionalIResolvableInputTransformeroptionalinterface{} #You can extract one or more key-value pairs from the event and then use that data to send customized input to the target.
kinesisParametersoptionalIResolvable | CfnRule.kinesis_parametersoptionaltyping.Union[IResolvable, KinesisParametersProperty]kinesisParametersoptionalIResolvableKinesisParametersoptionalIResolvableKinesisParametersoptionalinterface{} #If you do not include this parameter, the default is to use the eventId as the partition key.
redshiftDataParametersoptionalIResolvable | CfnRule.redshift_data_parametersoptionaltyping.Union[IResolvable, RedshiftDataParametersProperty]redshiftDataParametersoptionalIResolvableRedshiftDataParametersoptionalIResolvableRedshiftDataParametersoptionalinterface{} #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.
retryPolicyoptionalIResolvable | CfnRule.RetryPolicyPropertyretry_policyoptionaltyping.Union[IResolvable, RetryPolicyProperty]retryPolicyoptionalIResolvableRetryPolicyoptionalIResolvableRetryPolicyoptionalinterface{} #roleArnoptionalstringrole_arnoptionalstrroleArnoptionalStringRoleArnoptionalstringRoleArnoptional*string #If one rule triggers multiple targets, you can use a different IAM role for each target.
runCommandParametersoptionalIResolvable | CfnRule.run_command_parametersoptionaltyping.Union[IResolvable, RunCommandParametersProperty]runCommandParametersoptionalIResolvableRunCommandParametersoptionalIResolvableRunCommandParametersoptionalinterface{} #sageMakerPipelineParametersoptionalIResolvable | CfnRule.sage_maker_pipeline_parametersoptionaltyping.Union[IResolvable, SageMakerPipelineParametersProperty]sageMakerPipelineParametersoptionalIResolvableSageMakerPipelineParametersoptionalIResolvableSageMakerPipelineParametersoptionalinterface{} #If you specify a SageMaker AI Model Building Pipeline as a target, you can use this to specify parameters to start a pipeline execution based on EventBridge events.
sqsParametersoptionalIResolvable | CfnRule.SqsParametersPropertysqs_parametersoptionaltyping.Union[IResolvable, SqsParametersProperty]sqsParametersoptionalIResolvableSqsParametersoptionalIResolvableSqsParametersoptionalinterface{} #If you specify a fair or FIFO queue as a target, the queue must have content-based deduplication enabled.