rules
Creates, updates, deletes or gets a rule resource or lists rules in a region
Overview
| Name | rules |
| Type | Resource |
| Description | Resource Type definition for AWS::Events::Rule |
| Id | awscc.events.rules |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
event_bus_name | string | The name or ARN of the event bus associated with the rule. If you omit this, the default event bus is used. |
event_pattern | object | The event pattern of the rule. For more information, see Events and Event Patterns in the Amazon EventBridge User Guide. |
schedule_expression | string | 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. |
description | string | The description of the rule. |
state | string | The state of the rule. |
targets | array | Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.<br />Targets are the resources that are invoked when a rule is triggered. |
arn | string | The ARN of the rule, such as arn:aws:events:us-east-2:123456789012:rule/example. |
role_arn | string | The Amazon Resource Name (ARN) of the role that is used for target invocation. |
tags | array | Any tags assigned to the event rule. |
name | string | The name of the rule. |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
arn | string | The ARN of the rule, such as arn:aws:events:us-east-2:123456789012:rule/example. |
region | string | AWS region. |
For more information, see AWS::Events::Rule.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | rules | INSERT | region |
delete_resource | rules | DELETE | Identifier, region |
update_resource | rules | UPDATE | Identifier, PatchDocument, region |
list_resources | rules_list_only | SELECT | region |
get_resource | rules | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
Gets all properties from an individual rule.
SELECT
region,
event_bus_name,
event_pattern,
schedule_expression,
description,
state,
targets,
arn,
role_arn,
tags,
name
FROM awscc.events.rules
WHERE
region = 'us-east-1' AND
Identifier = '{{ arn }}';
Lists all rules in a region.
SELECT
region,
arn
FROM awscc.events.rules_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new rule resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.events.rules (
EventBusName,
EventPattern,
ScheduleExpression,
Description,
State,
Targets,
RoleArn,
Tags,
Name,
region
)
SELECT
'{{ event_bus_name }}',
'{{ event_pattern }}',
'{{ schedule_expression }}',
'{{ description }}',
'{{ state }}',
'{{ targets }}',
'{{ role_arn }}',
'{{ tags }}',
'{{ name }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.events.rules (
EventBusName,
EventPattern,
ScheduleExpression,
Description,
State,
Targets,
RoleArn,
Tags,
Name,
region
)
SELECT
'{{ event_bus_name }}',
'{{ event_pattern }}',
'{{ schedule_expression }}',
'{{ description }}',
'{{ state }}',
'{{ targets }}',
'{{ role_arn }}',
'{{ tags }}',
'{{ name }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: rule
props:
- name: event_bus_name
value: '{{ event_bus_name }}'
- name: event_pattern
value: {}
- name: schedule_expression
value: '{{ schedule_expression }}'
- name: description
value: '{{ description }}'
- name: state
value: '{{ state }}'
- name: targets
value:
- input_path: '{{ input_path }}'
http_parameters:
path_parameter_values:
- '{{ path_parameter_values[0] }}'
header_parameters: {}
query_string_parameters: {}
dead_letter_config:
arn: '{{ arn }}'
run_command_parameters:
run_command_targets:
- values:
- '{{ values[0] }}'
key: '{{ key }}'
input_transformer:
input_paths_map: {}
input_template: '{{ input_template }}'
kinesis_parameters:
partition_key_path: '{{ partition_key_path }}'
role_arn: '{{ role_arn }}'
redshift_data_parameters:
statement_name: '{{ statement_name }}'
sqls:
- '{{ sqls[0] }}'
database: '{{ database }}'
secret_manager_arn: '{{ secret_manager_arn }}'
db_user: '{{ db_user }}'
sql: '{{ sql }}'
with_event: '{{ with_event }}'
app_sync_parameters:
graph_ql_operation: '{{ graph_ql_operation }}'
input: '{{ input }}'
sqs_parameters:
message_group_id: '{{ message_group_id }}'
ecs_parameters:
platform_version: '{{ platform_version }}'
group: '{{ group }}'
enable_ecs_managed_tags: '{{ enable_ecs_managed_tags }}'
enable_execute_command: '{{ enable_execute_command }}'
placement_constraints:
- type: '{{ type }}'
expression: '{{ expression }}'
propagate_tags: '{{ propagate_tags }}'
task_count: '{{ task_count }}'
placement_strategies:
- field: '{{ field }}'
type: '{{ type }}'
capacity_provider_strategy:
- capacity_provider: '{{ capacity_provider }}'
base: '{{ base }}'
weight: '{{ weight }}'
launch_type: '{{ launch_type }}'
reference_id: '{{ reference_id }}'
tag_list:
- value: '{{ value }}'
key: '{{ key }}'
network_configuration:
aws_vpc_configuration:
security_groups:
- '{{ security_groups[0] }}'
subnets:
- '{{ subnets[0] }}'
assign_public_ip: '{{ assign_public_ip }}'
task_definition_arn: '{{ task_definition_arn }}'
batch_parameters:
array_properties:
size: '{{ size }}'
job_name: '{{ job_name }}'
retry_strategy:
attempts: '{{ attempts }}'
job_definition: '{{ job_definition }}'
id: '{{ id }}'
arn: '{{ arn }}'
sage_maker_pipeline_parameters:
pipeline_parameter_list:
- value: '{{ value }}'
name: '{{ name }}'
retry_policy:
maximum_retry_attempts: '{{ maximum_retry_attempts }}'
maximum_event_age_in_seconds: '{{ maximum_event_age_in_seconds }}'
- name: role_arn
value: '{{ role_arn }}'
- name: tags
value:
- null
- name: name
value: '{{ name }}'
UPDATE example
Use the following StackQL query and manifest file to update a rule resource, using stack-deploy.
/*+ update */
UPDATE awscc.events.rules
SET PatchDocument = string('{{ {
"EventBusName": event_bus_name,
"EventPattern": event_pattern,
"ScheduleExpression": schedule_expression,
"Description": description,
"State": state,
"Targets": targets,
"RoleArn": role_arn,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ arn }}';
DELETE example
/*+ delete */
DELETE FROM awscc.events.rules
WHERE
Identifier = '{{ arn }}' AND
region = 'us-east-1';
Permissions
To operate on the rules resource, the following permissions are required:
- Read
- Create
- Update
- List
- Delete
iam:PassRole,
events:DescribeRule,
events:ListTargetsByRule,
events:ListTagsForResource
iam:PassRole,
events:DescribeRule,
events:PutRule,
events:PutTargets,
events:TagResource
iam:PassRole,
events:DescribeRule,
events:PutRule,
events:RemoveTargets,
events:PutTargets,
events:UntagResource,
events:TagResource
events:ListRules
iam:PassRole,
events:DescribeRule,
events:DeleteRule,
events:RemoveTargets,
events:ListTargetsByRule