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:
CfnResource
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 . .. epigraph:
As an aid to help you jumpstart developing CloudFormation templates, the EventBridge console enables you to create templates from the existing rules in your account. For more information, see `Generating CloudFormation templates from an EventBridge rule <https://docs.aws.amazon.com/eventbridge/latest/userguide/rule-generate-template.html>`_ in the *Amazon EventBridge User Guide* .
- See:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-events-rule.html
- CloudformationResource:
AWS::Events::Rule
- ExampleMetadata:
fixture=_generated
Example:
# 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 # 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 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" ) )] )
- Parameters:
scope (
Construct
) – Scope in which this resource is defined.id (
str
) – Construct identifier for this resource (unique in its scope).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 (
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. Valid values include: -DISABLED
: The rule is disabled. EventBridge does not match any events against the rule. -ENABLED
: The rule is enabled. EventBridge matches events against the rule, except for AWS management events delivered through CloudTrail. -ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS
: The rule is enabled for all events, including AWS management events delivered through CloudTrail. Management events provide visibility into management operations that are performed on resources in your AWS account. These are also known as control plane operations. For more information, see Logging management events in the CloudTrail User Guide , and Filtering management events from AWS services in the Amazon EventBridge User Guide . This value is only valid for rules on the default event bus or custom event buses . It does not apply to partner event buses .targets (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,TargetProperty
,Dict
[str
,Any
]]],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. The maximum number of entries per request is 10. .. epigraph:: Each rule can have up to five (5) targets associated with it at one time. For a list of services you can configure as targets for events, see EventBridge targets in the Amazon EventBridge User Guide . Creating rules with built-in targets is supported only in the AWS Management Console . The built-in targets are: -Amazon EBS CreateSnapshot API call
-Amazon EC2 RebootInstances API call
-Amazon EC2 StopInstances API call
-Amazon EC2 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 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 . .. epigraph:: If you have an IAM role on a cross-account event bus target, aPutTargets
call without a role on the same target (sameId
andArn
) will not remove the role. 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_dependency(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_depends_on(target)
(deprecated) Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
- Parameters:
target (
CfnResource
) –- Deprecated:
use addDependency
- Stability:
deprecated
- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
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.
- 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 intermediate 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
). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT
). A list of resources that support this policy can be found in the following link:- 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 resource, please consult that specific resource’s documentation.
- See:
- Return type:
None
- get_att(attribute_name, type_hint=None)
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.type_hint (
Optional
[ResolutionTypeHint
]) –
- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
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.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) – tree inspector to collect and process attributes.- Return type:
None
- obtain_dependencies()
Retrieves an array of resources this resource depends on.
This assembles dependencies on resources across stacks (including nested stacks) automatically.
- Return type:
List
[Union
[Stack
,CfnResource
]]
- obtain_resource_dependencies()
Get a shallow copy of dependencies between this resource and other resources in the same stack.
- Return type:
List
[CfnResource
]
- 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
- remove_dependency(target)
Indicates that this resource no longer depends on another resource.
This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- replace_dependency(target, new_target)
Replaces one dependency with another.
- Parameters:
target (
CfnResource
) – The dependency to replace.new_target (
CfnResource
) – The new dependency to add.
- 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
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- 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.
- description
The description of the rule.
- event_bus_name
The name or ARN of the event bus associated with the rule.
- event_pattern
The event pattern of the rule.
- 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)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- name
The name of the rule.
- node
The tree node.
- 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 })
.
- role_arn
The Amazon Resource Name (ARN) of the role that is used for target invocation.
- schedule_expression
The scheduling expression.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- state
The state of the rule.
- targets
Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.
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(x)
Check whether the given object is a CfnResource.
- Parameters:
x (
Any
) –- Return type:
bool
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
AppSyncParametersProperty
- class CfnRule.AppSyncParametersProperty(*, graph_ql_operation)
Bases:
object
Contains the GraphQL operation to be parsed and executed, if the event target is an AWS AppSync API.
- Parameters:
graph_ql_operation (
str
) – The GraphQL operation; that is, the query, mutation, or subscription to be parsed and executed by the GraphQL service. For more information, see Operations in the AWS AppSync User Guide .- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 app_sync_parameters_property = events.CfnRule.AppSyncParametersProperty( graph_ql_operation="graphQlOperation" )
Attributes
- graph_ql_operation
The GraphQL operation; that is, the query, mutation, or subscription to be parsed and executed by the GraphQL service.
For more information, see Operations in the AWS AppSync User Guide .
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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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.- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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.
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
,Dict
[str
,Any
],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
,Dict
[str
,Any
],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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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.- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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.
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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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
Configuration details of the Amazon SQS queue for EventBridge to use as a dead-letter queue (DLQ).
For more information, see Using dead-letter queues to process undelivered events in the EventBridge User Guide .
- Parameters:
arn (
Optional
[str
]) – The ARN of the SQS queue specified as the target for the dead-letter queue.- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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
,Dict
[str
,Any
]]],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
,Dict
[str
,Any
],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
,Dict
[str
,Any
]]],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
,Dict
[str
,Any
]]],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
,Dict
[str
,Any
]]],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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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.
- enable_ecs_managed_tags
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 .
- propagate_tags
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.
- task_count
The number of tasks to create based on
TaskDefinition
.The default is 1.
- 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 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 API or EventBridge ApiDestination.path_parameter_values (
Optional
[Sequence
[str
]]) – The path parameter values to be used to populate API Gateway 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 API or EventBridge ApiDestination.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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 API or EventBridge ApiDestination.
- path_parameter_values
The path parameter values to be used to populate API Gateway 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 API or EventBridge ApiDestination.
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 > 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 .”
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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 .”
- 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 >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 .- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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
,Dict
[str
,Any
],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.- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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).
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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, db_user=None, secret_manager_arn=None, sql=None, sqls=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.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.sql (
Optional
[str
]) – The SQL statement text to run.sqls (
Optional
[Sequence
[str
]]) – One or more SQL statements to run. The SQL statements are run as a single transaction. They run serially in the order of the array. Subsequent SQL statements don’t start until the previous statement in the array completes. If any SQL statement fails, then because they are run as one transaction, all work is rolled back.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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 redshift_data_parameters_property = 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 )
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.
- sqls
One or more SQL statements to run.
The SQL statements are run as a single transaction. They run serially in the order of the array. Subsequent SQL statements don’t start until the previous statement in the array completes. If any SQL statement fails, then because they are run as one transaction, all work is rolled back.
- 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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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.
- 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.
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
,Dict
[str
,Any
]]]]) – Currently, we support including only one RunCommandTarget block, which specifies either an array of InstanceIds or a tag.- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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
,Dict
[str
,Any
]]],None
]) – List of Parameter names and values for SageMaker Model Building Pipeline execution.- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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.- See:
- ExampleMetadata:
fixture=_generated
Example:
# 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 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.
- See:
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. from aws_cdk import 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.
- value
The value for the specified tag key.
TargetProperty
- class CfnRule.TargetProperty(*, arn, id, app_sync_parameters=None, 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.app_sync_parameters (
Union
[IResolvable
,AppSyncParametersProperty
,Dict
[str
,Any
],None
]) – Contains the GraphQL operation to be parsed and executed, if the event target is an AWS AppSync API.batch_parameters (
Union
[IResolvable
,BatchParametersProperty
,Dict
[str
,Any
],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
,Dict
[str
,Any
],None
]) – TheDeadLetterConfig
that defines the target queue to send dead-letter queue events to.ecs_parameters (
Union
[IResolvable
,EcsParametersProperty
,Dict
[str
,Any
],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
,Dict
[str
,Any
],None
]) – Contains the HTTP parameters to use when the target is a API Gateway endpoint or EventBridge ApiDestination. If you specify an API Gateway API or EventBridge ApiDestination as a target, you can use this parameter to specify headers, path parameters, and query string keys/values as part of your target invoking request. If you’re using ApiDestinations, the corresponding Connection can also have these values configured. In case of any conflicting keys, values from the Connection take precedence.input (
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 may use JSON dot notation or bracket notation. For more information about JSON paths, see JSONPath .input_transformer (
Union
[IResolvable
,InputTransformerProperty
,Dict
[str
,Any
],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
,Dict
[str
,Any
],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
,Dict
[str
,Any
],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
,Dict
[str
,Any
],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
,Dict
[str
,Any
],None
]) – Parameters used when you are using the rule to invoke Amazon EC2 Run Command.sage_maker_pipeline_parameters (
Union
[IResolvable
,SageMakerPipelineParametersProperty
,Dict
[str
,Any
],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
,Dict
[str
,Any
],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.
- See:
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. 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" ) )
Attributes
- app_sync_parameters
Contains the GraphQL operation to be parsed and executed, if the event target is an AWS AppSync API.
- 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 endpoint or EventBridge ApiDestination.
If you specify an API Gateway API or EventBridge ApiDestination as a target, you can use this parameter to specify headers, path parameters, and query string keys/values as part of your target invoking request. If you’re using ApiDestinations, the corresponding Connection can also have these values configured. In case of any conflicting keys, values from the Connection take precedence.
- 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 may use JSON dot notation or 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.