boto3_cloudwatch_event

Connection module for Amazon CloudWatch Events using boto3.

Renamed from boto_cloudwatch_event to boto3_cloudwatch_event and rewritten to use the boto3 events client APIs directly via saltext.boto3.utils.boto3mod. The legacy boto2 code path (object-style access, retry loops) has been removed.

depends:
  • boto3 >= 1.28.0

  • botocore >= 1.31.0

configuration:

This module accepts explicit CloudWatch Events 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_event.keyid: GKTADJGHEIQSXMKKRBJ08H
cloudwatch_event.key: askdjghsdfjkghWupUjasdflkdfklgjsdfjajkghs

A region may also be specified in the configuration:

cloudwatch_event.region: us-east-1

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

Added in version 1.0.0.

saltext.boto3.modules.boto3_cloudwatch_event.__virtual__()[source]

Only load if boto3 is available.

saltext.boto3.modules.boto3_cloudwatch_event.exists(Name, region=None, key=None, keyid=None, profile=None)[source]

Given a rule name, check to see if the given rule exists.

Name (str):

The name of the CloudWatch event rule to check for existence.

region (str, optional):

The AWS region where the CloudWatch event rule is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt myminion boto3_cloudwatch_event.exists myevent region=us-east-1
saltext.boto3.modules.boto3_cloudwatch_event.create_or_update(Name, ScheduleExpression=None, EventPattern=None, Description=None, RoleArn=None, State=None, region=None, key=None, keyid=None, profile=None)[source]

Given a valid config, create an event rule.

Name (str):

The name of the CloudWatch event rule to create or update.

ScheduleExpression (str, optional):

The scheduling expression. For example, “rate(5 minutes)” or a cron expression.

EventPattern (str, optional):

The event pattern to match events.

Description (str, optional):

A description of the rule.

RoleArn (str, optional):

The ARN of the IAM role associated with the rule.

State (str, optional):

The state of the rule. Valid values are “ENABLED” and “DISABLED”.

region (str, optional):

The AWS region where the CloudWatch event rule is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt myminion boto3_cloudwatch_event.create_or_update my_rule
saltext.boto3.modules.boto3_cloudwatch_event.delete(Name, region=None, key=None, keyid=None, profile=None)[source]

Given a rule name, delete it.

Name (str):

The name of the CloudWatch event rule to delete.

region (str, optional):

The AWS region where the CloudWatch event rule is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt myminion boto3_cloudwatch_event.delete myrule
saltext.boto3.modules.boto3_cloudwatch_event.describe(Name, region=None, key=None, keyid=None, profile=None)[source]

Given a rule name describe its properties.

Name (str):

The name of the CloudWatch event rule to describe.

region (str, optional):

The AWS region where the CloudWatch event rule is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt myminion boto3_cloudwatch_event.describe myrule
saltext.boto3.modules.boto3_cloudwatch_event.list_rules(region=None, key=None, keyid=None, profile=None)[source]

List, with details, all CloudWatch Event rules visible in the current scope.

region (str, optional):

The AWS region where the CloudWatch event rules are located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt myminion boto3_cloudwatch_event.list_rules region=us-east-1
saltext.boto3.modules.boto3_cloudwatch_event.list_targets(Rule, region=None, key=None, keyid=None, profile=None)[source]

Given a rule name list the targets of that rule.

Rule (str):

The name of the CloudWatch event rule whose targets are to be listed.

region (str, optional):

The AWS region where the CloudWatch event rule is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt myminion boto3_cloudwatch_event.list_targets myrule
saltext.boto3.modules.boto3_cloudwatch_event.put_targets(Rule, Targets, region=None, key=None, keyid=None, profile=None)[source]

Add the given targets to the given rule.

Rule (str):

The name of the CloudWatch event rule to which the targets are to be added.

Targets (list):

A list of targets to add to the rule. Each target should be a dictionary containing the target’s details.

region (str, optional):

The AWS region where the CloudWatch event rule is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt myminion boto3_cloudwatch_event.put_targets myrule [{'Id':'target1','Arn':'arn:...'}]
saltext.boto3.modules.boto3_cloudwatch_event.remove_targets(Rule, Ids, region=None, key=None, keyid=None, profile=None)[source]

Given a rule name remove the named targets from the target list.

Rule (str):

The name of the CloudWatch event rule from which the targets are to be removed.

Ids (list):

A list of target IDs to remove from the rule. Each ID should be a string.

region (str, optional):

The AWS region where the CloudWatch event rule is located.

key (str, optional):

The AWS secret access key.

keyid (str, optional):

The AWS access key ID.

profile (str, optional):

The profile to use for AWS credentials.

CLI Example:

salt myminion boto3_cloudwatch_event.remove_targets myrule ['Target1']