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 | aws.events.rules |
Fields
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. 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. |
name | string | The name of the rule. |
region | string | AWS region. |
Methods
Name | Accessible by | Required Params |
---|---|---|
create_resource | INSERT | region |
delete_resource | DELETE | data__Identifier, region |
update_resource | UPDATE | data__Identifier, data__PatchDocument, region |
list_resources | SELECT | region |
get_resource | SELECT | data__Identifier, region |
SELECT
examples
Gets all rules
in a region.
SELECT
region,
event_bus_name,
event_pattern,
schedule_expression,
description,
state,
targets,
arn,
role_arn,
name
FROM aws.events.rules
WHERE region = 'us-east-1';
Gets all properties from an individual rule
.
SELECT
region,
event_bus_name,
event_pattern,
schedule_expression,
description,
state,
targets,
arn,
role_arn,
name
FROM aws.events.rules
WHERE region = 'us-east-1' AND data__Identifier = '<Arn>';
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 aws.events.rules (
EventBusName,
EventPattern,
ScheduleExpression,
Description,
State,
Targets,
RoleArn,
Name,
region
)
SELECT
'{{ EventBusName }}',
'{{ EventPattern }}',
'{{ ScheduleExpression }}',
'{{ Description }}',
'{{ State }}',
'{{ Targets }}',
'{{ RoleArn }}',
'{{ Name }}',
'{{ region }}';
/*+ create */
INSERT INTO aws.events.rules (
EventBusName,
EventPattern,
ScheduleExpression,
Description,
State,
Targets,
RoleArn,
Name,
region
)
SELECT
'{{ EventBusName }}',
'{{ EventPattern }}',
'{{ ScheduleExpression }}',
'{{ Description }}',
'{{ State }}',
'{{ Targets }}',
'{{ RoleArn }}',
'{{ Name }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: rule
props:
- name: EventBusName
value: '{{ EventBusName }}'
- name: EventPattern
value: {}
- name: ScheduleExpression
value: '{{ ScheduleExpression }}'
- name: Description
value: '{{ Description }}'
- name: State
value: '{{ State }}'
- name: Targets
value:
- InputPath: '{{ InputPath }}'
HttpParameters:
PathParameterValues:
- '{{ PathParameterValues[0] }}'
HeaderParameters: {}
QueryStringParameters: {}
DeadLetterConfig:
Arn: '{{ Arn }}'
RunCommandParameters:
RunCommandTargets:
- Values:
- '{{ Values[0] }}'
Key: '{{ Key }}'
InputTransformer:
InputPathsMap: {}
InputTemplate: '{{ InputTemplate }}'
KinesisParameters:
PartitionKeyPath: '{{ PartitionKeyPath }}'
RoleArn: '{{ RoleArn }}'
RedshiftDataParameters:
StatementName: '{{ StatementName }}'
Sqls:
- '{{ Sqls[0] }}'
Database: '{{ Database }}'
SecretManagerArn: '{{ SecretManagerArn }}'
DbUser: '{{ DbUser }}'
Sql: '{{ Sql }}'
WithEvent: '{{ WithEvent }}'
AppSyncParameters:
GraphQLOperation: '{{ GraphQLOperation }}'
Input: '{{ Input }}'
SqsParameters:
MessageGroupId: '{{ MessageGroupId }}'
EcsParameters:
PlatformVersion: '{{ PlatformVersion }}'
Group: '{{ Group }}'
EnableECSManagedTags: '{{ EnableECSManagedTags }}'
EnableExecuteCommand: '{{ EnableExecuteCommand }}'
PlacementConstraints:
- Type: '{{ Type }}'
Expression: '{{ Expression }}'
PropagateTags: '{{ PropagateTags }}'
TaskCount: '{{ TaskCount }}'
PlacementStrategies:
- Field: '{{ Field }}'
Type: '{{ Type }}'
CapacityProviderStrategy:
- CapacityProvider: '{{ CapacityProvider }}'
Base: '{{ Base }}'
Weight: '{{ Weight }}'
LaunchType: '{{ LaunchType }}'
ReferenceId: '{{ ReferenceId }}'
TagList:
- Value: '{{ Value }}'
Key: '{{ Key }}'
NetworkConfiguration:
AwsVpcConfiguration:
SecurityGroups:
- '{{ SecurityGroups[0] }}'
Subnets:
- '{{ Subnets[0] }}'
AssignPublicIp: '{{ AssignPublicIp }}'
TaskDefinitionArn: '{{ TaskDefinitionArn }}'
BatchParameters:
ArrayProperties:
Size: '{{ Size }}'
JobName: '{{ JobName }}'
RetryStrategy:
Attempts: '{{ Attempts }}'
JobDefinition: '{{ JobDefinition }}'
Id: '{{ Id }}'
Arn: '{{ Arn }}'
SageMakerPipelineParameters:
PipelineParameterList:
- Value: '{{ Value }}'
Name: '{{ Name }}'
RetryPolicy:
MaximumRetryAttempts: '{{ MaximumRetryAttempts }}'
MaximumEventAgeInSeconds: '{{ MaximumEventAgeInSeconds }}'
- name: RoleArn
value: '{{ RoleArn }}'
- name: Name
value: '{{ Name }}'
DELETE
example
/*+ delete */
DELETE FROM aws.events.rules
WHERE data__Identifier = '<Arn>'
AND region = 'us-east-1';
Permissions
To operate on the rules
resource, the following permissions are required:
Read
iam:PassRole,
events:DescribeRule,
events:ListTargetsByRule
Create
iam:PassRole,
events:DescribeRule,
events:PutRule,
events:PutTargets
Update
iam:PassRole,
events:DescribeRule,
events:PutRule,
events:RemoveTargets,
events:PutTargets
List
events:ListRules
Delete
iam:PassRole,
events:DescribeRule,
events:DeleteRule,
events:RemoveTargets,
events:ListTargetsByRule