CfnRule¶
-
class
aws_cdk.aws_events.
CfnRule
(scope, id, *, description=None, event_bus_name=None, event_pattern=None, name=None, role_arn=None, schedule_expression=None, state=None, targets=None)¶ Bases:
aws_cdk.core.CfnResource
A CloudFormation
AWS::Events::Rule
.Creates or updates the specified rule. Rules are enabled by default, or based on value of the state. You can disable a rule using DisableRule .
A single rule watches for events from a single event bus. Events generated by AWS services go to your account’s default event bus. Events generated by SaaS partner services or applications go to the matching partner event bus. If you have custom applications or services, you can specify whether their events go to your default event bus or a custom event bus that you have created. For more information, see CreateEventBus .
If you are updating an existing rule, the rule is replaced with what you specify in this
PutRule
command. If you omit arguments inPutRule
, the old values for those arguments are not kept. Instead, they are replaced with null values.When you create or update a rule, incoming events might not immediately start matching to new or updated rules. Allow a short period of time for changes to take effect.
A rule must contain at least an EventPattern or ScheduleExpression. Rules with EventPatterns are triggered when a matching event is observed. Rules with ScheduleExpressions self-trigger based on the given schedule. A rule can have both an EventPattern and a ScheduleExpression, in which case the rule triggers on matching events as well as on a schedule.
Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, EventBridge uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the event you want to match.
In EventBridge, it is possible to create rules that lead to infinite loops, where a rule is fired repeatedly. For example, a rule might detect that ACLs have changed on an S3 bucket, and trigger software to change them to the desired state. If the rule is not written carefully, the subsequent change to the ACLs fires the rule again, creating an infinite loop.
To prevent this, write the rules so that the triggered actions do not re-fire the same rule. For example, your rule could fire only if ACLs are found to be in a bad state, instead of after any change.
An infinite loop can quickly cause higher than expected charges. We recommend that you use budgeting, which alerts you when charges exceed your specified limit. For more information, see Managing Your Costs with Budgets .
- CloudformationResource
AWS::Events::Rule
- Link
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events # event_pattern: Any cfn_rule = events.CfnRule(self, "MyCfnRule", description="description", event_bus_name="eventBusName", event_pattern=event_pattern, name="name", role_arn="roleArn", schedule_expression="scheduleExpression", state="state", targets=[events.CfnRule.TargetProperty( arn="arn", id="id", # the properties below are optional 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", sql="sql", # the properties below are optional db_user="dbUser", secret_manager_arn="secretManagerArn", 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" ) )] )
Create a new
AWS::Events::Rule
.- Parameters
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
description (
Optional
[str
]) – The description of the rule.event_bus_name (
Optional
[str
]) – The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used.event_pattern (
Optional
[Any
]) – The event pattern of the rule. For more information, see Events and Event Patterns in the Amazon EventBridge User Guide .name (
Optional
[str
]) – The name of the rule.role_arn (
Optional
[str
]) – The Amazon Resource Name (ARN) of the role that is used for target invocation. If you’re setting an event bus in another account as the target and that account granted permission to your account through an organization instead of directly by the account ID, you must specify aRoleArn
with proper permissions in theTarget
structure, instead of here in this parameter.schedule_expression (
Optional
[str
]) – The scheduling expression. For example, “cron(0 20 * * ? *)”, “rate(5 minutes)”. For more information, see Creating an Amazon EventBridge rule that runs on a schedule .state (
Optional
[str
]) – The state of the rule.targets (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,TargetProperty
]],None
]) – Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule. Targets are the resources that are invoked when a rule is triggered. .. epigraph:: Each rule can have up to five (5) targets associated with it at one time. You can configure the following as targets for Events: - API destination - API Gateway - Batch job queue - CloudWatch group - CodeBuild project - CodePipeline - EC2CreateSnapshot
API call - EC2 Image Builder - EC2RebootInstances
API call - EC2StopInstances
API call - EC2TerminateInstances
API call - ECS task - Event bus in a different account or Region - Event bus in the same account and Region - Firehose delivery stream - Glue workflow - Incident Manager response plan - Inspector assessment template - Kinesis stream - Lambda function - Redshift cluster - SageMaker Pipeline - SNS topic - SQS queue - Step Functions state machine - Systems Manager Automation - Systems Manager OpsItem - Systems Manager Run Command Creating rules with built-in targets is supported only in the AWS Management Console . The built-in targets areEC2 CreateSnapshot API call
,EC2 RebootInstances API call
,EC2 StopInstances API call
, andEC2 TerminateInstances API call
. For some target types,PutTargets
provides target-specific parameters. If the target is a Kinesis data stream, you can optionally specify which shard the event goes to by using theKinesisParameters
argument. To invoke a command on multiple EC2 instances with one rule, you can use theRunCommandParameters
field. To be able to make API calls against the resources that you own, Amazon EventBridge needs the appropriate permissions. For AWS Lambda and Amazon SNS resources, EventBridge relies on resource-based policies. For EC2 instances, Kinesis Data Streams, AWS Step Functions state machines and API Gateway REST APIs, EventBridge relies on IAM roles that you specify in theRoleARN
argument inPutTargets
. For more information, see Authentication and Access Control in the Amazon EventBridge User Guide . If another AWS account is in the same region and has granted you permission (usingPutPermission
), you can send events to that account. Set that account’s event bus as a target of the rules in your account. To send the matched events to the other account, specify that account’s event bus as theArn
value when you runPutTargets
. If your account sends events to another account, your account is charged for each sent event. Each event sent to another account is charged as a custom event. The account receiving the event is not charged. For more information, see Amazon EventBridge Pricing . .. epigraph::Input
,InputPath
, andInputTransformer
are not available withPutTarget
if the target is an event bus of a different AWS account. 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 aRoleArn
with proper permissions in theTarget
structure. For more information, see Sending and Receiving Events Between AWS Accounts in the Amazon EventBridge User Guide . For more information about enabling cross-account events, see PutPermission . Input , InputPath , and InputTransformer are mutually exclusive and optional parameters of a target. When a rule is triggered due to a matched event: - If none of the following arguments are specified for a target, then the entire event is passed to the target in JSON format (unless the target is Amazon EC2 Run Command or Amazon ECS task, in which case nothing from the event is passed to the target). - If Input is specified in the form of valid JSON, then the matched event is overridden with this constant. - If InputPath is specified in the form of JSONPath (for example,$.detail
), then only the part of the event specified in the path is passed to the target (for example, only the detail part of the event is passed). - If InputTransformer is specified, then one or more specified JSONPaths are extracted from the event and used as values in a template that you specify as the input to the target. When you specifyInputPath
orInputTransformer
, you must use JSON dot notation, not bracket notation. When you add targets to a rule and the associated rule triggers soon after, new or updated targets might not be immediately invoked. Allow a short period of time for changes to take effect. This action can partially fail if too many requests are made at the same time. If that happens,FailedEntryCount
is non-zero in the response and each entry inFailedEntries
provides the ID of the failed target and the error code.
Methods
-
add_deletion_override
(path)¶ Syntactic sugar for
addOverride(path, undefined)
.- Parameters
path (
str
) – The path of the value to delete.- Return type
None
-
add_depends_on
(target)¶ Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters
target (
CfnResource
) –- Return type
None
-
add_metadata
(key, value)¶ Add a value to the CloudFormation Resource Metadata.
- Parameters
key (
str
) –value (
Any
) –
- See
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- Return type
None
-
add_override
(path, value)¶ Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type
None
-
add_property_deletion_override
(property_path)¶ Adds an override that deletes the value of a property from the resource definition.
- Parameters
property_path (
str
) – The path to the property.- Return type
None
-
add_property_override
(property_path, value)¶ Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type
None
-
apply_removal_policy
(policy=None, *, apply_to_update_replace_policy=None, default=None)¶ Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type
None
-
get_att
(attribute_name)¶ Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters
attribute_name (
str
) – The name of the attribute.- Return type
-
get_metadata
(key)¶ Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters
key (
str
) –- See
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- Return type
Any
-
inspect
(inspector)¶ Examines the CloudFormation resource and discloses attributes.
- Parameters
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type
None
-
override_logical_id
(new_logical_id)¶ Overrides the auto-generated logical ID with a specific ID.
- Parameters
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type
None
-
to_string
()¶ Returns a string representation of this construct.
- Return type
str
- Returns
a string representation of this resource
Attributes
-
CFN_RESOURCE_TYPE_NAME
= 'AWS::Events::Rule'¶
-
attr_arn
¶ The ARN of the rule, such as
arn:aws:events:us-east-2:123456789012:rule/example
.- CloudformationAttribute
Arn
- Return type
str
-
cfn_options
¶ Options for this resource, such as condition, update policy etc.
- Return type
-
cfn_resource_type
¶ AWS resource type.
- Return type
str
-
creation_stack
¶ return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- Return type
List
[str
]
-
description
¶ The description of the rule.
- Link
- Return type
Optional
[str
]
-
event_bus_name
¶ The name or ARN of the event bus associated with the rule.
If you omit this, the default event bus is used.
- Link
- Return type
Optional
[str
]
-
event_pattern
¶ The event pattern of the rule.
For more information, see Events and Event Patterns in the Amazon EventBridge User Guide .
-
logical_id
¶ The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Return type
str
- Returns
the logical ID as a stringified token. This value will only get resolved during synthesis.
-
name
¶ The name of the rule.
- Link
- Return type
Optional
[str
]
-
node
¶ The construct tree node associated with this construct.
- Return type
-
ref
¶ Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.- Return type
str
-
role_arn
¶ The Amazon Resource Name (ARN) of the role that is used for target invocation.
If you’re setting an event bus in another account as the target and that account granted permission to your account through an organization instead of directly by the account ID, you must specify a
RoleArn
with proper permissions in theTarget
structure, instead of here in this parameter.- Link
- Return type
Optional
[str
]
-
schedule_expression
¶ The scheduling expression.
For example, “cron(0 20 * * ? *)”, “rate(5 minutes)”. For more information, see Creating an Amazon EventBridge rule that runs on a schedule .
-
stack
¶ The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- Return type
-
state
¶ The state of the rule.
- Link
- Return type
Optional
[str
]
-
targets
¶ Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.
Targets are the resources that are invoked when a rule is triggered. .. epigraph:
Each rule can have up to five (5) targets associated with it at one time.
You can configure the following as targets for Events:
Batch job queue
CloudWatch group
CodeBuild project
CodePipeline
EC2
CreateSnapshot
API callEC2 Image Builder
EC2
RebootInstances
API callEC2
StopInstances
API callEC2
TerminateInstances
API callECS task
Firehose delivery stream
Glue workflow
Inspector assessment template
Kinesis stream
Lambda function
Redshift cluster
SageMaker Pipeline
SNS topic
SQS queue
Step Functions state machine
Systems Manager Automation
Systems Manager OpsItem
Systems Manager Run Command
Creating rules with built-in targets is supported only in the AWS Management Console . The built-in targets are
EC2 CreateSnapshot API call
,EC2 RebootInstances API call
,EC2 StopInstances API call
, andEC2 TerminateInstances API call
.For some target types,
PutTargets
provides target-specific parameters. If the target is a Kinesis data stream, you can optionally specify which shard the event goes to by using theKinesisParameters
argument. To invoke a command on multiple EC2 instances with one rule, you can use theRunCommandParameters
field.To be able to make API calls against the resources that you own, Amazon EventBridge needs the appropriate permissions. For AWS Lambda and Amazon SNS resources, EventBridge relies on resource-based policies. For EC2 instances, Kinesis Data Streams, AWS Step Functions state machines and API Gateway REST APIs, EventBridge relies on IAM roles that you specify in the
RoleARN
argument inPutTargets
. For more information, see Authentication and Access Control in the Amazon EventBridge User Guide .If another AWS account is in the same region and has granted you permission (using
PutPermission
), you can send events to that account. Set that account’s event bus as a target of the rules in your account. To send the matched events to the other account, specify that account’s event bus as theArn
value when you runPutTargets
. If your account sends events to another account, your account is charged for each sent event. Each event sent to another account is charged as a custom event. The account receiving the event is not charged. For more information, see Amazon EventBridge Pricing . .. epigraph:``Input`` , ``InputPath`` , and ``InputTransformer`` are not available with ``PutTarget`` if the target is an event bus of a different AWS account.
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 theTarget
structure. For more information, see Sending and Receiving Events Between AWS Accounts in the Amazon EventBridge User Guide .For more information about enabling cross-account events, see PutPermission .
Input , InputPath , and InputTransformer are mutually exclusive and optional parameters of a target. When a rule is triggered due to a matched event:
If none of the following arguments are specified for a target, then the entire event is passed to the target in JSON format (unless the target is Amazon EC2 Run Command or Amazon ECS task, in which case nothing from the event is passed to the target).
If Input is specified in the form of valid JSON, then the matched event is overridden with this constant.
If InputPath is specified in the form of JSONPath (for example,
$.detail
), then only the part of the event specified in the path is passed to the target (for example, only the detail part of the event is passed).If InputTransformer is specified, then one or more specified JSONPaths are extracted from the event and used as values in a template that you specify as the input to the target.
When you specify
InputPath
orInputTransformer
, you must use JSON dot notation, not bracket notation.When you add targets to a rule and the associated rule triggers soon after, new or updated targets might not be immediately invoked. Allow a short period of time for changes to take effect.
This action can partially fail if too many requests are made at the same time. If that happens,
FailedEntryCount
is non-zero in the response and each entry inFailedEntries
provides the ID of the failed target and the error code.- Link
- Return type
Union
[IResolvable
,List
[Union
[IResolvable
,TargetProperty
]],None
]
Static Methods
-
classmethod
is_cfn_element
(x)¶ Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters
x (
Any
) –- Return type
bool
- Returns
The construct as a stack element or undefined if it is not a stack element.
-
classmethod
is_cfn_resource
(construct)¶ Check whether the given construct is a CfnResource.
- Parameters
construct (
IConstruct
) –- Return type
bool
-
classmethod
is_construct
(x)¶ Return whether the given object is a Construct.
- Parameters
x (
Any
) –- Return type
bool
AwsVpcConfigurationProperty¶
-
class
CfnRule.
AwsVpcConfigurationProperty
(*, subnets, assign_public_ip=None, security_groups=None)¶ Bases:
object
This structure specifies the VPC subnets and security groups for the task, and whether a public IP address is to be used.
This structure is relevant only for ECS tasks that use the
awsvpc
network mode.- Parameters
subnets (
Sequence
[str
]) – Specifies the subnets associated with the task. These subnets must all be in the same VPC. You can specify as many as 16 subnets.assign_public_ip (
Optional
[str
]) – Specifies whether the task’s elastic network interface receives a public IP address. You can specifyENABLED
only whenLaunchType
inEcsParameters
is set toFARGATE
.security_groups (
Optional
[Sequence
[str
]]) – Specifies the security groups associated with the task. These security groups must all be in the same VPC. You can specify as many as five security groups. If you do not specify a security group, the default security group for the VPC is used.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events aws_vpc_configuration_property = events.CfnRule.AwsVpcConfigurationProperty( subnets=["subnets"], # the properties below are optional assign_public_ip="assignPublicIp", security_groups=["securityGroups"] )
Attributes
-
assign_public_ip
¶ Specifies whether the task’s elastic network interface receives a public IP address.
You can specify
ENABLED
only whenLaunchType
inEcsParameters
is set toFARGATE
.
-
security_groups
¶ Specifies the security groups associated with the task.
These security groups must all be in the same VPC. You can specify as many as five security groups. If you do not specify a security group, the default security group for the VPC is used.
-
subnets
¶ Specifies the subnets associated with the task.
These subnets must all be in the same VPC. You can specify as many as 16 subnets.
BatchArrayPropertiesProperty¶
-
class
CfnRule.
BatchArrayPropertiesProperty
(*, size=None)¶ Bases:
object
The array properties for the submitted job, such as the size of the array.
The array size can be between 2 and 10,000. If you specify array properties for a job, it becomes an array job. This parameter is used only if the target is an AWS Batch job.
- Parameters
size (
Union
[int
,float
,None
]) – The size of the array, if this is an array batch job. Valid values are integers between 2 and 10,000.- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events batch_array_properties_property = events.CfnRule.BatchArrayPropertiesProperty( size=123 )
Attributes
-
size
¶ The size of the array, if this is an array batch job.
Valid values are integers between 2 and 10,000.
- Link
- Return type
Union
[int
,float
,None
]
BatchParametersProperty¶
-
class
CfnRule.
BatchParametersProperty
(*, job_definition, job_name, array_properties=None, retry_strategy=None)¶ Bases:
object
The custom parameters to be used when the target is an AWS Batch job.
- Parameters
job_definition (
str
) – The ARN or name of the job definition to use if the event target is an AWS Batch job. This job definition must already exist.job_name (
str
) – The name to use for this execution of the job, if the target is an AWS Batch job.array_properties (
Union
[IResolvable
,BatchArrayPropertiesProperty
,None
]) – The array properties for the submitted job, such as the size of the array. The array size can be between 2 and 10,000. If you specify array properties for a job, it becomes an array job. This parameter is used only if the target is an AWS Batch job.retry_strategy (
Union
[IResolvable
,BatchRetryStrategyProperty
,None
]) – The retry strategy to use for failed jobs, if the target is an AWS Batch job. The retry strategy is the number of times to retry the failed job execution. Valid values are 1–10. When you specify a retry strategy here, it overrides the retry strategy defined in the job definition.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events batch_parameters_property = 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 ) )
Attributes
-
array_properties
¶ The array properties for the submitted job, such as the size of the array.
The array size can be between 2 and 10,000. If you specify array properties for a job, it becomes an array job. This parameter is used only if the target is an AWS Batch job.
-
job_definition
¶ The ARN or name of the job definition to use if the event target is an AWS Batch job.
This job definition must already exist.
-
job_name
¶ The name to use for this execution of the job, if the target is an AWS Batch job.
-
retry_strategy
¶ The retry strategy to use for failed jobs, if the target is an AWS Batch job.
The retry strategy is the number of times to retry the failed job execution. Valid values are 1–10. When you specify a retry strategy here, it overrides the retry strategy defined in the job definition.
BatchRetryStrategyProperty¶
-
class
CfnRule.
BatchRetryStrategyProperty
(*, attempts=None)¶ Bases:
object
The retry strategy to use for failed jobs, if the target is an AWS Batch job.
If you specify a retry strategy here, it overrides the retry strategy defined in the job definition.
- Parameters
attempts (
Union
[int
,float
,None
]) – The number of times to attempt to retry, if the job fails. Valid values are 1–10.- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events batch_retry_strategy_property = events.CfnRule.BatchRetryStrategyProperty( attempts=123 )
Attributes
-
attempts
¶ The number of times to attempt to retry, if the job fails.
Valid values are 1–10.
- Link
- Return type
Union
[int
,float
,None
]
CapacityProviderStrategyItemProperty¶
-
class
CfnRule.
CapacityProviderStrategyItemProperty
(*, capacity_provider, base=None, weight=None)¶ Bases:
object
The details of a capacity provider strategy.
To learn more, see CapacityProviderStrategyItem in the Amazon ECS API Reference.
- Parameters
capacity_provider (
str
) – The short name of the capacity provider.base (
Union
[int
,float
,None
]) – The base value designates how many tasks, at a minimum, to run on the specified capacity provider. Only one capacity provider in a capacity provider strategy can have a base defined. If no value is specified, the default value of 0 is used.weight (
Union
[int
,float
,None
]) – The weight value designates the relative percentage of the total number of tasks launched that should use the specified capacity provider. The weight value is taken into consideration after the base value, if defined, is satisfied.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events capacity_provider_strategy_item_property = events.CfnRule.CapacityProviderStrategyItemProperty( capacity_provider="capacityProvider", # the properties below are optional base=123, weight=123 )
Attributes
-
base
¶ The base value designates how many tasks, at a minimum, to run on the specified capacity provider.
Only one capacity provider in a capacity provider strategy can have a base defined. If no value is specified, the default value of 0 is used.
-
capacity_provider
¶ The short name of the capacity provider.
-
weight
¶ The weight value designates the relative percentage of the total number of tasks launched that should use the specified capacity provider.
The weight value is taken into consideration after the base value, if defined, is satisfied.
DeadLetterConfigProperty¶
-
class
CfnRule.
DeadLetterConfigProperty
(*, arn=None)¶ Bases:
object
A
DeadLetterConfig
object that contains information about a dead-letter queue configuration.- Parameters
arn (
Optional
[str
]) – The ARN of the SQS queue specified as the target for the dead-letter queue.- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events dead_letter_config_property = events.CfnRule.DeadLetterConfigProperty( arn="arn" )
Attributes
-
arn
¶ The ARN of the SQS queue specified as the target for the dead-letter queue.
EcsParametersProperty¶
-
class
CfnRule.
EcsParametersProperty
(*, task_definition_arn, capacity_provider_strategy=None, enable_ecs_managed_tags=None, enable_execute_command=None, group=None, launch_type=None, network_configuration=None, placement_constraints=None, placement_strategies=None, platform_version=None, propagate_tags=None, reference_id=None, tag_list=None, task_count=None)¶ Bases:
object
The custom parameters to be used when the target is an Amazon ECS task.
- Parameters
task_definition_arn (
str
) – The ARN of the task definition to use if the event target is an Amazon ECS task.capacity_provider_strategy (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,CapacityProviderStrategyItemProperty
]],None
]) – The capacity provider strategy to use for the task. If acapacityProviderStrategy
is specified, thelaunchType
parameter must be omitted. If nocapacityProviderStrategy
or launchType is specified, thedefaultCapacityProviderStrategy
for the cluster is used.enable_ecs_managed_tags (
Union
[bool
,IResolvable
,None
]) – Specifies whether to enable Amazon ECS managed tags for the task. For more information, see Tagging Your Amazon ECS Resources in the Amazon Elastic Container Service Developer Guide.enable_execute_command (
Union
[bool
,IResolvable
,None
]) – Whether or not to enable the execute command functionality for the containers in this task. If true, this enables execute command functionality on all containers in the task.group (
Optional
[str
]) – Specifies an ECS task group for the task. The maximum length is 255 characters.launch_type (
Optional
[str
]) – Specifies the launch type on which your task is running. The launch type that you specify here must match one of the launch type (compatibilities) of the target task. TheFARGATE
value is supported only in the Regions where AWS Fargate with Amazon ECS is supported. For more information, see AWS Fargate on Amazon ECS in the Amazon Elastic Container Service Developer Guide .network_configuration (
Union
[IResolvable
,NetworkConfigurationProperty
,None
]) – Use this structure if the Amazon ECS task uses theawsvpc
network mode. This structure specifies the VPC subnets and security groups associated with the task, and whether a public IP address is to be used. This structure is required ifLaunchType
isFARGATE
because theawsvpc
mode is required for Fargate tasks. If you specifyNetworkConfiguration
when the target ECS task does not use theawsvpc
network mode, the task fails.placement_constraints (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,PlacementConstraintProperty
]],None
]) – An array of placement constraint objects to use for the task. You can specify up to 10 constraints per task (including constraints in the task definition and those specified at runtime).placement_strategies (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,PlacementStrategyProperty
]],None
]) – The placement strategy objects to use for the task. You can specify a maximum of five strategy rules per task.platform_version (
Optional
[str
]) – Specifies the platform version for the task. Specify only the numeric portion of the platform version, such as1.1.0
. This structure is used only ifLaunchType
isFARGATE
. For more information about valid platform versions, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide .propagate_tags (
Optional
[str
]) – Specifies whether to propagate the tags from the task definition to the task. If no value is specified, the tags are not propagated. Tags can only be propagated to the task during task creation. To add tags to a task after task creation, use the TagResource API action.reference_id (
Optional
[str
]) – The reference ID to use for the task.tag_list (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,CfnTag
]],None
]) – The metadata that you apply to the task to help you categorize and organize them. Each tag consists of a key and an optional value, both of which you define. To learn more, see RunTask in the Amazon ECS API Reference.task_count (
Union
[int
,float
,None
]) – The number of tasks to create based onTaskDefinition
. The default is 1.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events ecs_parameters_property = 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 )
Attributes
-
capacity_provider_strategy
¶ The capacity provider strategy to use for the task.
If a
capacityProviderStrategy
is specified, thelaunchType
parameter must be omitted. If nocapacityProviderStrategy
or launchType is specified, thedefaultCapacityProviderStrategy
for the cluster is used.
Specifies whether to enable Amazon ECS managed tags for the task.
For more information, see Tagging Your Amazon ECS Resources in the Amazon Elastic Container Service Developer Guide.
-
enable_execute_command
¶ Whether or not to enable the execute command functionality for the containers in this task.
If true, this enables execute command functionality on all containers in the task.
-
group
¶ Specifies an ECS task group for the task.
The maximum length is 255 characters.
-
launch_type
¶ Specifies the launch type on which your task is running.
The launch type that you specify here must match one of the launch type (compatibilities) of the target task. The
FARGATE
value is supported only in the Regions where AWS Fargate with Amazon ECS is supported. For more information, see AWS Fargate on Amazon ECS in the Amazon Elastic Container Service Developer Guide .
-
network_configuration
¶ Use this structure if the Amazon ECS task uses the
awsvpc
network mode.This structure specifies the VPC subnets and security groups associated with the task, and whether a public IP address is to be used. This structure is required if
LaunchType
isFARGATE
because theawsvpc
mode is required for Fargate tasks.If you specify
NetworkConfiguration
when the target ECS task does not use theawsvpc
network mode, the task fails.
-
placement_constraints
¶ An array of placement constraint objects to use for the task.
You can specify up to 10 constraints per task (including constraints in the task definition and those specified at runtime).
-
placement_strategies
¶ The placement strategy objects to use for the task.
You can specify a maximum of five strategy rules per task.
-
platform_version
¶ Specifies the platform version for the task.
Specify only the numeric portion of the platform version, such as
1.1.0
.This structure is used only if
LaunchType
isFARGATE
. For more information about valid platform versions, see AWS Fargate Platform Versions in the Amazon Elastic Container Service Developer Guide .
Specifies whether to propagate the tags from the task definition to the task.
If no value is specified, the tags are not propagated. Tags can only be propagated to the task during task creation. To add tags to a task after task creation, use the TagResource API action.
-
reference_id
¶ The reference ID to use for the task.
-
tag_list
¶ The metadata that you apply to the task to help you categorize and organize them.
Each tag consists of a key and an optional value, both of which you define. To learn more, see RunTask in the Amazon ECS API Reference.
- Link
- Return type
Union
[IResolvable
,List
[Union
[IResolvable
,CfnTag
]],None
]
-
task_count
¶ The number of tasks to create based on
TaskDefinition
.The default is 1.
- Link
- Return type
Union
[int
,float
,None
]
-
task_definition_arn
¶ The ARN of the task definition to use if the event target is an Amazon ECS task.
HttpParametersProperty¶
-
class
CfnRule.
HttpParametersProperty
(*, header_parameters=None, path_parameter_values=None, query_string_parameters=None)¶ Bases:
object
These are custom parameter to be used when the target is an API Gateway REST APIs or EventBridge ApiDestinations.
In the latter case, these are merged with any InvocationParameters specified on the Connection, with any values from the Connection taking precedence.
- Parameters
header_parameters (
Union
[IResolvable
,Mapping
[str
,str
],None
]) – The headers that need to be sent as part of request invoking the API Gateway REST API or EventBridge ApiDestination.path_parameter_values (
Optional
[Sequence
[str
]]) – The path parameter values to be used to populate API Gateway REST API or EventBridge ApiDestination path wildcards (“*”).query_string_parameters (
Union
[IResolvable
,Mapping
[str
,str
],None
]) – The query string keys/values that need to be sent as part of request invoking the API Gateway REST API or EventBridge ApiDestination.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events http_parameters_property = events.CfnRule.HttpParametersProperty( header_parameters={ "header_parameters_key": "headerParameters" }, path_parameter_values=["pathParameterValues"], query_string_parameters={ "query_string_parameters_key": "queryStringParameters" } )
Attributes
-
header_parameters
¶ The headers that need to be sent as part of request invoking the API Gateway REST API or EventBridge ApiDestination.
- Link
- Return type
Union
[IResolvable
,Mapping
[str
,str
],None
]
-
path_parameter_values
¶ The path parameter values to be used to populate API Gateway REST API or EventBridge ApiDestination path wildcards (“*”).
-
query_string_parameters
¶ The query string keys/values that need to be sent as part of request invoking the API Gateway REST API or EventBridge ApiDestination.
- Link
- Return type
Union
[IResolvable
,Mapping
[str
,str
],None
]
InputTransformerProperty¶
-
class
CfnRule.
InputTransformerProperty
(*, input_template, input_paths_map=None)¶ Bases:
object
Contains the parameters needed for you to provide custom input to a target based on one or more pieces of data extracted from the event.
- Parameters
input_template (
str
) – Input template where you specify placeholders that will be filled with the values of the keys fromInputPathsMap
to customize the data sent to the target. Enclose eachInputPathsMaps
value in brackets: < value > The InputTemplate must be valid JSON. IfInputTemplate
is a JSON object (surrounded by curly braces), the following restrictions apply: - The placeholder cannot be used as an object key. The following example shows the syntax for usingInputPathsMap
andInputTemplate
."InputTransformer":
{
"InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"},
"InputTemplate": "<instance> is in state <status>"
}
To have theInputTemplate
include quote marks within a JSON string, escape each quote marks with a slash, as in the following example:"InputTransformer":
{
"InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"},
"InputTemplate": "<instance> is in state \"<status>\""
}
TheInputTemplate
can also be valid JSON with varibles in quotes or out, as in the following example:"InputTransformer":
{
"InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"},
"InputTemplate": '{"myInstance": <instance>,"myStatus": "<instance> is in state \"<status>\""}'
}
input_paths_map (
Union
[IResolvable
,Mapping
[str
,str
],None
]) – Map of JSON paths to be extracted from the event. You can then insert these in the template inInputTemplate
to produce the output you want to be sent to the target.InputPathsMap
is an array key-value pairs, where each value is a valid JSON path. You can have as many as 100 key-value pairs. You must use JSON dot notation, not bracket notation. The keys cannot start with ” AWS .”
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events input_transformer_property = events.CfnRule.InputTransformerProperty( input_template="inputTemplate", # the properties below are optional input_paths_map={ "input_paths_map_key": "inputPathsMap" } )
Attributes
-
input_paths_map
¶ Map of JSON paths to be extracted from the event.
You can then insert these in the template in
InputTemplate
to produce the output you want to be sent to the target.InputPathsMap
is an array key-value pairs, where each value is a valid JSON path. You can have as many as 100 key-value pairs. You must use JSON dot notation, not bracket notation.The keys cannot start with ” AWS .”
- Link
- Return type
Union
[IResolvable
,Mapping
[str
,str
],None
]
-
input_template
¶ Input template where you specify placeholders that will be filled with the values of the keys from
InputPathsMap
to customize the data sent to the target.Enclose each
InputPathsMaps
value in brackets: < value > The InputTemplate must be valid JSON.If
InputTemplate
is a JSON object (surrounded by curly braces), the following restrictions apply:The placeholder cannot be used as an object key.
The following example shows the syntax for using
InputPathsMap
andInputTemplate
."InputTransformer":
{
"InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"},
"InputTemplate": "<instance> is in state <status>"
}
To have the
InputTemplate
include quote marks within a JSON string, escape each quote marks with a slash, as in the following example:"InputTransformer":
{
"InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"},
"InputTemplate": "<instance> is in state \"<status>\""
}
The
InputTemplate
can also be valid JSON with varibles in quotes or out, as in the following example:"InputTransformer":
{
"InputPathsMap": {"instance": "$.detail.instance","status": "$.detail.status"},
"InputTemplate": '{"myInstance": <instance>,"myStatus": "<instance> is in state \"<status>\""}'
}
KinesisParametersProperty¶
-
class
CfnRule.
KinesisParametersProperty
(*, partition_key_path)¶ Bases:
object
This object enables you to specify a JSON path to extract from the event and use as the partition key for the Amazon Kinesis data stream, so that you can control the shard to which the event goes.
If you do not include this parameter, the default is to use the
eventId
as the partition key.- Parameters
partition_key_path (
str
) – The JSON path to be extracted from the event and used as the partition key. For more information, see Amazon Kinesis Streams Key Concepts in the Amazon Kinesis Streams Developer Guide .- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events kinesis_parameters_property = events.CfnRule.KinesisParametersProperty( partition_key_path="partitionKeyPath" )
Attributes
-
partition_key_path
¶ The JSON path to be extracted from the event and used as the partition key.
For more information, see Amazon Kinesis Streams Key Concepts in the Amazon Kinesis Streams Developer Guide .
NetworkConfigurationProperty¶
-
class
CfnRule.
NetworkConfigurationProperty
(*, aws_vpc_configuration=None)¶ Bases:
object
This structure specifies the network configuration for an ECS task.
- Parameters
aws_vpc_configuration (
Union
[IResolvable
,AwsVpcConfigurationProperty
,None
]) – Use this structure to specify the VPC subnets and security groups for the task, and whether a public IP address is to be used. This structure is relevant only for ECS tasks that use theawsvpc
network mode.- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events network_configuration_property = events.CfnRule.NetworkConfigurationProperty( aws_vpc_configuration=events.CfnRule.AwsVpcConfigurationProperty( subnets=["subnets"], # the properties below are optional assign_public_ip="assignPublicIp", security_groups=["securityGroups"] ) )
Attributes
-
aws_vpc_configuration
¶ Use this structure to specify the VPC subnets and security groups for the task, and whether a public IP address is to be used.
This structure is relevant only for ECS tasks that use the
awsvpc
network mode.
PlacementConstraintProperty¶
-
class
CfnRule.
PlacementConstraintProperty
(*, expression=None, type=None)¶ Bases:
object
An object representing a constraint on task placement.
To learn more, see Task Placement Constraints in the Amazon Elastic Container Service Developer Guide.
- Parameters
expression (
Optional
[str
]) – A cluster query language expression to apply to the constraint. You cannot specify an expression if the constraint type isdistinctInstance
. To learn more, see Cluster Query Language in the Amazon Elastic Container Service Developer Guide.type (
Optional
[str
]) – The type of constraint. Use distinctInstance to ensure that each task in a particular group is running on a different container instance. Use memberOf to restrict the selection to a group of valid candidates.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events placement_constraint_property = events.CfnRule.PlacementConstraintProperty( expression="expression", type="type" )
Attributes
-
expression
¶ A cluster query language expression to apply to the constraint.
You cannot specify an expression if the constraint type is
distinctInstance
. To learn more, see Cluster Query Language in the Amazon Elastic Container Service Developer Guide.
-
type
¶ The type of constraint.
Use distinctInstance to ensure that each task in a particular group is running on a different container instance. Use memberOf to restrict the selection to a group of valid candidates.
PlacementStrategyProperty¶
-
class
CfnRule.
PlacementStrategyProperty
(*, field=None, type=None)¶ Bases:
object
The task placement strategy for a task or service.
To learn more, see Task Placement Strategies in the Amazon Elastic Container Service Service Developer Guide.
- Parameters
field (
Optional
[str
]) – The field to apply the placement strategy against. For the spread placement strategy, valid values are instanceId (or host, which has the same effect), or any platform or custom attribute that is applied to a container instance, such as attribute:ecs.availability-zone. For the binpack placement strategy, valid values are cpu and memory. For the random placement strategy, this field is not used.type (
Optional
[str
]) – The type of placement strategy. The random placement strategy randomly places tasks on available candidates. The spread placement strategy spreads placement across available candidates evenly based on the field parameter. The binpack strategy places tasks on available candidates that have the least available amount of the resource that is specified with the field parameter. For example, if you binpack on memory, a task is placed on the instance with the least amount of remaining memory (but still enough to run the task).
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events placement_strategy_property = events.CfnRule.PlacementStrategyProperty( field="field", type="type" )
Attributes
-
field
¶ The field to apply the placement strategy against.
For the spread placement strategy, valid values are instanceId (or host, which has the same effect), or any platform or custom attribute that is applied to a container instance, such as attribute:ecs.availability-zone. For the binpack placement strategy, valid values are cpu and memory. For the random placement strategy, this field is not used.
-
type
¶ The type of placement strategy.
The random placement strategy randomly places tasks on available candidates. The spread placement strategy spreads placement across available candidates evenly based on the field parameter. The binpack strategy places tasks on available candidates that have the least available amount of the resource that is specified with the field parameter. For example, if you binpack on memory, a task is placed on the instance with the least amount of remaining memory (but still enough to run the task).
RedshiftDataParametersProperty¶
-
class
CfnRule.
RedshiftDataParametersProperty
(*, database, sql, db_user=None, secret_manager_arn=None, statement_name=None, with_event=None)¶ Bases:
object
These are custom parameters to be used when the target is a Amazon Redshift cluster to invoke the Amazon Redshift Data API ExecuteStatement based on EventBridge events.
- Parameters
database (
str
) – The name of the database. Required when authenticating using temporary credentials.sql (
str
) – The SQL statement text to run.db_user (
Optional
[str
]) – The database user name. Required when authenticating using temporary credentials.secret_manager_arn (
Optional
[str
]) – The name or ARN of the secret that enables access to the database. Required when authenticating using AWS Secrets Manager.statement_name (
Optional
[str
]) – The name of the SQL statement. You can name the SQL statement when you create it to identify the query.with_event (
Union
[bool
,IResolvable
,None
]) – Indicates whether to send an event back to EventBridge after the SQL statement runs.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events redshift_data_parameters_property = events.CfnRule.RedshiftDataParametersProperty( database="database", sql="sql", # the properties below are optional db_user="dbUser", secret_manager_arn="secretManagerArn", statement_name="statementName", with_event=False )
Attributes
-
database
¶ The name of the database.
Required when authenticating using temporary credentials.
-
db_user
¶ The database user name.
Required when authenticating using temporary credentials.
-
secret_manager_arn
¶ The name or ARN of the secret that enables access to the database.
Required when authenticating using AWS Secrets Manager.
-
sql
¶ The SQL statement text to run.
-
statement_name
¶ The name of the SQL statement.
You can name the SQL statement when you create it to identify the query.
-
with_event
¶ Indicates whether to send an event back to EventBridge after the SQL statement runs.
RetryPolicyProperty¶
-
class
CfnRule.
RetryPolicyProperty
(*, maximum_event_age_in_seconds=None, maximum_retry_attempts=None)¶ Bases:
object
A
RetryPolicy
object that includes information about the retry policy settings.- Parameters
maximum_event_age_in_seconds (
Union
[int
,float
,None
]) – The maximum amount of time, in seconds, to continue to make retry attempts.maximum_retry_attempts (
Union
[int
,float
,None
]) – The maximum number of retry attempts to make before the request fails. Retry attempts continue until either the maximum number of attempts is made or until the duration of theMaximumEventAgeInSeconds
is met.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events retry_policy_property = events.CfnRule.RetryPolicyProperty( maximum_event_age_in_seconds=123, maximum_retry_attempts=123 )
Attributes
-
maximum_event_age_in_seconds
¶ The maximum amount of time, in seconds, to continue to make retry attempts.
- Link
- Return type
Union
[int
,float
,None
]
-
maximum_retry_attempts
¶ The maximum number of retry attempts to make before the request fails.
Retry attempts continue until either the maximum number of attempts is made or until the duration of the
MaximumEventAgeInSeconds
is met.- Link
- Return type
Union
[int
,float
,None
]
RunCommandParametersProperty¶
-
class
CfnRule.
RunCommandParametersProperty
(*, run_command_targets)¶ Bases:
object
This parameter contains the criteria (either InstanceIds or a tag) used to specify which EC2 instances are to be sent the command.
- Parameters
run_command_targets (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,RunCommandTargetProperty
]]]) – Currently, we support including only one RunCommandTarget block, which specifies either an array of InstanceIds or a tag.- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events run_command_parameters_property = events.CfnRule.RunCommandParametersProperty( run_command_targets=[events.CfnRule.RunCommandTargetProperty( key="key", values=["values"] )] )
Attributes
-
run_command_targets
¶ Currently, we support including only one RunCommandTarget block, which specifies either an array of InstanceIds or a tag.
RunCommandTargetProperty¶
-
class
CfnRule.
RunCommandTargetProperty
(*, key, values)¶ Bases:
object
Information about the EC2 instances that are to be sent the command, specified as key-value pairs.
Each
RunCommandTarget
block can include only one key, but this key may specify multiple values.- Parameters
key (
str
) – Can be eithertag:
tag-key orInstanceIds
.values (
Sequence
[str
]) – IfKey
istag:
tag-key ,Values
is a list of tag values. IfKey
isInstanceIds
,Values
is a list of Amazon EC2 instance IDs.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events run_command_target_property = events.CfnRule.RunCommandTargetProperty( key="key", values=["values"] )
Attributes
-
key
¶ Can be either
tag:
tag-key orInstanceIds
.
-
values
¶ If
Key
istag:
tag-key ,Values
is a list of tag values.If
Key
isInstanceIds
,Values
is a list of Amazon EC2 instance IDs.
SageMakerPipelineParameterProperty¶
-
class
CfnRule.
SageMakerPipelineParameterProperty
(*, name, value)¶ Bases:
object
Name/Value pair of a parameter to start execution of a SageMaker Model Building Pipeline.
- Parameters
name (
str
) – Name of parameter to start execution of a SageMaker Model Building Pipeline.value (
str
) – Value of parameter to start execution of a SageMaker Model Building Pipeline.
- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events sage_maker_pipeline_parameter_property = events.CfnRule.SageMakerPipelineParameterProperty( name="name", value="value" )
Attributes
-
name
¶ Name of parameter to start execution of a SageMaker Model Building Pipeline.
-
value
¶ Value of parameter to start execution of a SageMaker Model Building Pipeline.
SageMakerPipelineParametersProperty¶
-
class
CfnRule.
SageMakerPipelineParametersProperty
(*, pipeline_parameter_list=None)¶ Bases:
object
These are custom parameters to use when the target is a SageMaker Model Building Pipeline that starts based on EventBridge events.
- Parameters
pipeline_parameter_list (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,SageMakerPipelineParameterProperty
]],None
]) – List of Parameter names and values for SageMaker Model Building Pipeline execution.- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events sage_maker_pipeline_parameters_property = events.CfnRule.SageMakerPipelineParametersProperty( pipeline_parameter_list=[events.CfnRule.SageMakerPipelineParameterProperty( name="name", value="value" )] )
Attributes
-
pipeline_parameter_list
¶ List of Parameter names and values for SageMaker Model Building Pipeline execution.
SqsParametersProperty¶
-
class
CfnRule.
SqsParametersProperty
(*, message_group_id)¶ Bases:
object
This structure includes the custom parameter to be used when the target is an SQS FIFO queue.
- Parameters
message_group_id (
str
) – The FIFO message group ID to use as the target.- Link
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events sqs_parameters_property = events.CfnRule.SqsParametersProperty( message_group_id="messageGroupId" )
Attributes
-
message_group_id
¶ The FIFO message group ID to use as the target.
TagProperty¶
-
class
CfnRule.
TagProperty
(*, key=None, value=None)¶ Bases:
object
A key-value pair associated with an ECS Target of an EventBridge rule.
The tag will be propagated to ECS by EventBridge when starting an ECS task based on a matched event. .. epigraph:
Currently, tags are only available when using ECS with EventBridge .
- Parameters
key (
Optional
[str
]) – A string you can use to assign a value. The combination of tag keys and values can help you organize and categorize your resources.value (
Optional
[str
]) – The value for the specified tag key.
- Link
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-tag.html
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events tag_property = events.CfnRule.TagProperty( key="key", value="value" )
Attributes
-
key
¶ A string you can use to assign a value.
The combination of tag keys and values can help you organize and categorize your resources.
- Link
- Return type
Optional
[str
]
-
value
¶ The value for the specified tag key.
- Link
- Return type
Optional
[str
]
TargetProperty¶
-
class
CfnRule.
TargetProperty
(*, arn, id, batch_parameters=None, dead_letter_config=None, ecs_parameters=None, http_parameters=None, input=None, input_path=None, input_transformer=None, kinesis_parameters=None, redshift_data_parameters=None, retry_policy=None, role_arn=None, run_command_parameters=None, sage_maker_pipeline_parameters=None, sqs_parameters=None)¶ Bases:
object
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 theTarget
structure. For more information, see Sending and Receiving Events Between AWS Accounts in the Amazon EventBridge User Guide .- Parameters
arn (
str
) – The Amazon Resource Name (ARN) of the target.id (
str
) – 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.batch_parameters (
Union
[IResolvable
,BatchParametersProperty
,None
]) – 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 .dead_letter_config (
Union
[IResolvable
,DeadLetterConfigProperty
,None
]) – TheDeadLetterConfig
that defines the target queue to send dead-letter queue events to.ecs_parameters (
Union
[IResolvable
,EcsParametersProperty
,None
]) – 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 .http_parameters (
Union
[IResolvable
,HttpParametersProperty
,None
]) – Contains the HTTP parameters to use when the target is a API Gateway REST endpoint or EventBridge ApiDestination. If you specify an API Gateway REST 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 (
Optional
[str
]) – 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 .input_path (
Optional
[str
]) – The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. You must use JSON dot notation, not bracket notation. For more information about JSON paths, see JSONPath .input_transformer (
Union
[IResolvable
,InputTransformerProperty
,None
]) – 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.kinesis_parameters (
Union
[IResolvable
,KinesisParametersProperty
,None
]) – 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 theeventId
as the partition key.redshift_data_parameters (
Union
[IResolvable
,RedshiftDataParametersProperty
,None
]) – 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.retry_policy (
Union
[IResolvable
,RetryPolicyProperty
,None
]) – TheRetryPolicy
object that contains the retry policy configuration to use for the dead-letter queue.role_arn (
Optional
[str
]) – 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.run_command_parameters (
Union
[IResolvable
,RunCommandParametersProperty
,None
]) – Parameters used when you are using the rule to invoke Amazon EC2 Run Command.sage_maker_pipeline_parameters (
Union
[IResolvable
,SageMakerPipelineParametersProperty
,None
]) – 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.sqs_parameters (
Union
[IResolvable
,SqsParametersProperty
,None
]) – 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.
- Link
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-events-rule-target.html
- ExampleMetadata
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_events as events target_property = events.CfnRule.TargetProperty( arn="arn", id="id", # the properties below are optional 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", sql="sql", # the properties below are optional db_user="dbUser", secret_manager_arn="secretManagerArn", 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" ) )
Attributes
-
arn
¶ The Amazon Resource Name (ARN) of the target.
-
batch_parameters
¶ 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 .
-
dead_letter_config
¶ The
DeadLetterConfig
that defines the target queue to send dead-letter queue events to.
-
ecs_parameters
¶ 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 .
-
http_parameters
¶ Contains the HTTP parameters to use when the target is a API Gateway REST endpoint or EventBridge ApiDestination.
If you specify an API Gateway REST 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.
-
id
¶ 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.
-
input
¶ 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 .
-
input_path
¶ The value of the JSONPath that is used for extracting part of the matched event when passing it to the target.
You must use JSON dot notation, not bracket notation. For more information about JSON paths, see JSONPath .
-
input_transformer
¶ 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.
-
kinesis_parameters
¶ 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.
-
redshift_data_parameters
¶ 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.
-
retry_policy
¶ The
RetryPolicy
object that contains the retry policy configuration to use for the dead-letter queue.
-
role_arn
¶ 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.
-
run_command_parameters
¶ Parameters used when you are using the rule to invoke Amazon EC2 Run Command.
-
sage_maker_pipeline_parameters
¶ 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.
-
sqs_parameters
¶ 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.