boto3_cloudwatch_event¶
Manage CloudWatch Event Rules using boto3.¶
Renamed from
boto_cloudwatch_eventtoboto3_cloudwatch_eventand updated to call the refactoredboto3_cloudwatch_eventexecution module.
Create and destroy CloudWatch event rules. Be aware that this interacts with Amazon’s services, and so may incur charges.
- depends:
boto3 >= 1.28.0
botocore >= 1.31.0
This module uses boto3, which can be installed via package, or pip.
This module accepts explicit CloudWatch credentials but can also utilize IAM roles assigned to the instance through Instance Profiles. Dynamic credentials are then automatically obtained from AWS API and no further configuration is necessary. More Information available at:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
If IAM roles are not used you need to specify them either in the minion’s config file or as a profile. For example, to specify them in the minion’s config file:
cloudwatch.keyid: GKTADJGHEIQSXMKKRBJ08H
cloudwatch.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
It’s also possible to specify key, keyid and region via a profile, either as a passed in dict, or as a string to pull from pillars or minion config:
myprofile:
keyid: GKTADJGHEIQSXMKKRBJ08H
key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
region: us-east-1
Ensure event rule exists:
boto3_cloudwatch_event.present:
- Name: mytrail
- ScheduleExpression: 'rate(120 minutes)'
- State: 'DISABLED'
- Targets:
- Id: "target1"
Arn: "arn:aws:lambda:us-west-1:124456715622:function:my_function"
Input: '{"arbitrary": "json"}'
Added in version 1.0.0.
- saltext.boto3.states.boto3_cloudwatch_event.__virtual__()[source]¶
Only load if the boto3_cloudwatch_event execution module is available.
- saltext.boto3.states.boto3_cloudwatch_event.present(name, Name=None, ScheduleExpression=None, EventPattern=None, Description=None, RoleArn=None, State=None, Targets=None, region=None, key=None, keyid=None, profile=None)[source]¶
Ensure the CloudWatch event rule exists.
- name
The name of the state definition.
- Name
Name of the event rule. Defaults to the value of
nameif not provided.- ScheduleExpression
The scheduling expression. For example,
cron(0 20 * * ? *)orrate(5 minutes).- EventPattern
The event pattern.
- Description
A description of the rule.
- State
Indicates whether the rule is ENABLED or DISABLED.
- RoleArn
The ARN of the IAM role associated with the rule.
- Targets
A list of resources to be invoked when the rule is triggered.
- region
Region to connect to.
- key
Secret key to be used.
- keyid
Access key to be used.
- profile
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Example:
ensure-present: boto3_cloudwatch_event.present: - name: example
- saltext.boto3.states.boto3_cloudwatch_event.absent(name, Name=None, region=None, key=None, keyid=None, profile=None)[source]¶
Ensure CloudWatch event rule with passed properties is absent.
- name
The name of the state definition.
- Name
Name of the event rule. Defaults to the value of
nameif not provided.- region
Region to connect to.
- key
Secret key to be used.
- keyid
Access key to be used.
- profile
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
Example:
ensure-absent: boto3_cloudwatch_event.absent: - name: example