New in version 2016.11.0.
Create and destroy CloudWatch event rules. Be aware that this interacts with Amazon's services, and so may incur charges.
This module uses boto3
, which can be installed via package, or pip.
This module accepts explicit vpc 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 here.
If IAM roles are not used you need to specify them either in a pillar file or in the minion's config file:
cloudwatch_event.keyid: GKTADJGHEIQSXMKKRBJ08H
cloudwatch_event.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
It's also possible to specify key
, keyid
and region
via a profile,
either passed in as a 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:
boto_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"}'
- region: us-east-1
- keyid: GKTADJGHEIQSXMKKRBJ08H
- key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs
salt.states.boto_cloudwatch_event.
absent
(name, Name=None, region=None, key=None, keyid=None, profile=None)¶Ensure CloudWatch event rule with passed properties is absent.
The name of the state definition.
Name of the event rule. Defaults to the value of the 'name' param if not provided.
Region to connect to.
Secret key to be used.
Access key to be used.
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.
salt.states.boto_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)¶Ensure trail exists.
The name of the state definition
Name of the event rule. Defaults to the value of the 'name' param if not provided.
The scheduling expression. For example, cron(0 20 * * ? *)
,
"rate(5 minutes)"
The event pattern.
A description of the rule
Indicates whether the rule is ENABLED or DISABLED.
The Amazon Resource Name (ARN) of the IAM role associated with the rule.
A list of rresources to be invoked when the rule is triggered.
Region to connect to.
Secret key to be used.
Access key to be used.
A dict with region, key and keyid, or a pillar key (string) that contains a dict with region, key and keyid.